https://github.com/eosnewmedia/arangodb-3-connector
Factory and interface wrappers for simpler and cleaner usage of triagens/arangodb
https://github.com/eosnewmedia/arangodb-3-connector
arangodb arangodb-client php php7
Last synced: 23 days ago
JSON representation
Factory and interface wrappers for simpler and cleaner usage of triagens/arangodb
- Host: GitHub
- URL: https://github.com/eosnewmedia/arangodb-3-connector
- Owner: eosnewmedia
- License: mit
- Created: 2019-02-01T13:20:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-02-18T10:21:52.000Z (over 4 years ago)
- Last Synced: 2025-03-30T15:51:13.795Z (about 2 months ago)
- Topics: arangodb, arangodb-client, php, php7
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
eos/arango-db-3-connector
=========================
Factory and interface wrappers for simpler and cleaner usage of `triagens/arangodb`.## Installation
```bash
composer req eos/arango-db-3-connector
```## Usage
The simplest way to use this library is to create an instance of `ArangoDB` which implements `ArangoDBInterface`.
```php
true, // your connection configuration
]
);// create your database
$arangoDB->database()->createDatabase();// create your first collection
$arangoDB->collections()->createDocumentCollection('example');// create your first document
$arangoDB->execute('INSERT { name: @name } INTO example', ['name'=>'Test']);// for custom statements use: $arangoDB->statements()->createStatement([...]);
```
### Connections
Connections will be created by an instance of `ConnectionFactoryInterface` if their are needed.The default implementation of `ConnectionFactoryInterface` is `ConnectionFactory`:
```php
true, // your connection configuration
]
);```
### Database Management
Your database could be managed with an instance of `DatabaseHandlerInterface`.The default implementation of `DatabaseHandlerInterface` is `DatabaseHandler`:
```php
createDatabase();// if your database user is not allowed to create a new database, overwrite the configured user for this action:
$databaseHandler->createDatabase('admin_user','admin_password');// remove your database (configured in the connection)
$databaseHandler->removeDatabase();// if your database user is not allowed to remove a database, overwrite the configured user for this action:
$databaseHandler->removeDatabase('admin_user','admin_password');```
### Collection Management
Your collections could be managed with an instance of `CollectionHandlerInterface`.The default implementation of `CollectionHandlerInterface` is `CollectionHandler`:
```php
createDocumentCollection('your_collection');// create an edge collection
$collectionHandler->createEdgeCollection('your_collection');// create an index for a collection
$collectionHandler->createIndex('your_collection','hash',['your_field']);// remove a collection
$collectionHandler->removeCollection('your_collection');```
### Statements
Your statements could be created by an instance of `StatementFactoryInterface`.The default implementation of `StatementFactoryInterface` is `StatementFactory`:
```php
createStatement(['query'=>'FOR document IN your_collection RETURN document']);
$cursor = $statement->execute();// create query statement
$statement =$statementFactory->createQueryStatement('INSERT { name: @name } INTO your_collection', ['name'=>'Test']);
$statement->execute();```