crassaert / php-azure-documentdb
PHP wrapper to query Microsoft Azure DocumentDB REST API
Installs: 8 904
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 3
Forks: 6
Open Issues: 2
Requires
- ext-curl: *
Requires (Dev)
- fzaninotto/faker: ^1.7
- phpunit/phpunit: 6.5.*
This package is not auto-updated.
Last update: 2024-12-21 19:49:01 UTC
README
PHP wrapper for CosmosDB (ex DocumentDB) operations (beta version)
Update January 2018 v1.1
- Use of the x-ms-version 2017-02-22
- PHP 7.0 mini recommended
- Enhanced unit tests
- Adding some errors throws
Usage
Install
composer require crassaert/php-azure-documentdb
Instantiate
$db = new AzureDocumentDB(AZURE_HOST, AZURE_KEY, false);
Databases operation
List
$db->get('database')->_list();
Creation
$db->get('database')->create('my_database');
Selection
$db->get('database')->select('my_database');
Remove
$db->get('database')->delete('my_database');
Collections
Before requesting, you have to select a database (see previous paragraph).
List
$db->get('collection')->_list();
Creation
$db->get('collection')->create('my_collection');
Selection
$db->get('collection')->select('my_collection');
Remove
$db->get('collection')->delete('my_collection');
Document
Before requesting, you have to select a database and a collection (see previous paragraph).
Creation
$db->get('document')->create($json);
Requesting
Fell free to write your SQL query here.
$db->get('document')->query('SELECT * FROM my_table');
Remove
You have to select your document before removing it to obtain the internal ID.
$rid = $document->_rid;
$db->get('document')->delete($rid);
TODO
Implement permissions, triggers, users, sprocs and UDF.
You can find all features on Microsoft Azure Website