|
1 | | -# sqlitecloud-php |
| 1 | +# Driver for SQLite Cloud |
| 2 | + |
| 3 | +<p align="center"> |
| 4 | + <img src="https://sqlitecloud.io/social/logo.png" height="300" alt="SQLite Cloud logo"> |
| 5 | +</p> |
| 6 | + |
| 7 | + |
| 8 | +[](https://github.com/sqlitecloud/sqlitecloud-php/actions/workflows/deploy.yaml) |
| 9 | +[](https://codecov.io/gh/sqlitecloud/sqlitecloud-php) |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +- [Driver for SQLite Cloud](#driver-for-sqlite-cloud) |
| 14 | +- [Example](#example) |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +[SQLite Cloud](https://sqlitecloud.io) is a powerful Python package that allows you to interact with the SQLite Cloud database seamlessly. It provides methods for various database operations. This package is designed to simplify database operations in PHP applications, making it easier than ever to work with SQLite Cloud. |
| 19 | + |
| 20 | + |
| 21 | +- Documentation: [https://docs.sqlitecloud.io/docs/sdk/php/admin](https://docs.sqlitecloud.io/docs/sdk/php/admin) |
| 22 | +- Source: [https://github.com/sqlitecloud/sqlitecloud-php](https://github.com/sqlitecloud/sqlitecloud-php) |
| 23 | +- Site: [https://sqlitecloud.io](https://sqlitecloud.io/developers) |
| 24 | + |
| 25 | +## Example |
| 26 | + |
| 27 | +```bash |
| 28 | +$ composer install sqlitecloud/sqlitecloud |
| 29 | +``` |
| 30 | + |
| 31 | +```php |
| 32 | +use use SQLiteCloud\SQLiteCloudClient; |
| 33 | +use SQLiteCloud\SQLiteCloudRowset; |
| 34 | + |
| 35 | +# Open the connection to SQLite Cloud |
| 36 | +$sqlite = new SQLiteCloud(); |
| 37 | +$sqlite->connectWithString('sqlitecloud://myhost.sqlite.cloud:8860?apikey=myapikey'); |
| 38 | + |
| 39 | +# You can autoselect the database during the connect call |
| 40 | +# by adding the database name as path of the SQLite Cloud |
| 41 | +# connection string, eg: |
| 42 | +# $sqlite->connectWithString("sqlitecloud://myhost.sqlite.cloud:8860/mydatabase?apikey=myapikey"); |
| 43 | +$db_name = 'chinook.sqlite'; |
| 44 | +$sqlite->execute("USE DATABASE {$db_name}"); |
| 45 | + |
| 46 | + /** @var SQLiteCloudRowset */ |
| 47 | +$rowset = $sqlite->execute('SELECT * FROM albums WHERE AlbumId = 1'); |
| 48 | + |
| 49 | +print('First colum, first row: ' . $rowset->value(0, 0)); |
| 50 | +print('Second colum, first row: ' . $rowset->value(0, 1)); |
| 51 | +print('column name: ' . $rowset->name(1)); |
| 52 | + |
| 53 | +$sqlite->disconnect() |
| 54 | +``` |
0 commit comments