1. Go to this page and download the library: Download neosmic/arango-php-ogm library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
Neosmic\ArangoPhpOgm\BinaryDb::start(); // Inicia la conexión a la base de datos
$main = Neosmic\ArangoPhpOgm\BinaryDb::main(); //Devuelve el nodo main
...
// Buscar el archivo .env en la carpeta /src y crear el objeto para manipular la base de datos
$arangoDbOgm = BinaryDb::start([ 'envDir' => realpath(dirname(__FILE__)) . '/src' ]);
// Devuelve los valores almacenados en el nodo main.
$main = $arangoDbOgm::main();
// Preparar datos para guardar en un nuevo nodo
$data = [
'propiedad' => 'valor',
'propiedad2' => 'valor2'
];
// crea un nuevo nodo almacena los datos y devuelve el nodo creado
$new = $arangoDbOgm::insert($data);
// conecta el nodo creado con el nodo main
$arangoDbOgm::link($new['_key'], $main['_key'], ['_tag' => 'hijo']);
// Eliminar conexiones al nuevo nodo
$arangoDbOgm::unlink($main['_key'], $new['_key']);
// Eliminar el nodo creado
$arangoDbOgm::remove($new['_key']);
`cmd
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.