11# ArangoDB PHP client
22
3- Low level PHP client for ArangoDB. Supports PHP versions 7 & 8.
3+ Low level PHP client for ArangoDB. Supports PHP versions 7.4 & ^8.0
44
55![ Github CI tests] ( https://github.com/LaravelFreelancerNL/arangodb-php-client/workflows/CI%20tests/badge.svg )
66[ ![ Scrutinizer Code Quality] ( https://scrutinizer-ci.com/g/LaravelFreelancerNL/arangodb-php-client/badges/quality-score.png?b=next )] ( https://scrutinizer-ci.com/g/LaravelFreelancerNL/arangodb-php-client/?branch=next )
@@ -16,27 +16,56 @@ composer require laravel-freelancer-nl/arangodb-php-client
1616```
1717## Quickstart
1818
19+ ### Create a new client
20+ ```
21+ $client = new ArangoClient($config);
1922```
20- // Create a new connector
21- $this->connector = new Connector($config);
2223
23- //Create the domain clients that suit your purpose and pass the connector to the client.
24- $this->schemaClient = new SchemaClient($this->connector);
24+ ### Create a collection
25+ Use the schemaManager to create a new collection.
26+ ```
27+ $client->schema()->createCollection('users');
28+ ```
2529
26- //Create a database
27- $this->schemaClient->createDatabase('MyKillahProject');
30+ ### Get documents from the collection
31+ ```
32+ $statement = $client->prepare('FOR user in Users RETURN user');
33+ $statement->execute();
34+ $users = $statement->fetchAll();
2835```
36+ As there are no users yet in the above example this will yield an empty result.
37+ Note that this client does not have any preconceptions about the data structure
38+ and thus everything is returned as raw arrays.
2939
3040### config
3141The connector has a default configuration for a local ArangoDB instance at it's default port (8529).
3242
33- ## Client domains
34- ### AdministrationClient
35- Manages administrative functions
43+ ## AQL statements
44+ To run AQL queries you prepare a query, execute it and fetch the results. Much like PHP's PDO extension.
45+
46+ ```
47+ $statement = $client->prepare('FOR user in users RETURN user');
48+ $statement->execute();
49+ $users = $statement->fetchAll();
50+ ```
3651
52+ ## Managers
53+ You have access to several managers that allow you to perform specific tasks on your ArangoDB instance(s).
3754
38- ### SchemaClient
39- Manages schema related tasks like creating databases, collections, indexes, views and graphs
55+ (ArangoDB's endpoints are mapped to these managers in a semantically functional manner. Therefore a manager
56+ may have functionality from different endpoints within ArangoDB's HTTP API.)
57+
58+ ### Admin
59+ Manages administrative functions to manage the server/cluster and retrieve server level information.
60+ ```
61+ $client->admin()->getVersion();
62+ ```
63+
64+ ### Schema
65+ The schema manager allows you perform tasks like creating databases, collections, indexes, views and graphs
66+ ```
67+ $client->schema()->createCollection('users');
68+ ```
4069
4170## Related packages
4271[ AQL query builder] ( https://github.com/LaravelFreelancerNL/fluentaql )
0 commit comments