1. Go to this page and download the library: Download nuad/graph-objects 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/ */
nuad / graph-objects example snippets
class Person
{
public $id;
public $name;
public $gender;
public function __construct($id, $name, $gender)
{
$this->id = $id;
$this->name = $name;
$this->gender = $gender;
}
}
use Nuad\Graph\Entity;
use Nuad\Graph\Graphable;
use Nuad\Graph\GraphAdapter;
use Nuad\Graph\Type;
class Person implements Graphable
{
use GraphAdapter;
public $id;
public $name;
public $gender;
public function __construct($id, $name, $gender)
{
$this->id = $id;
$this->name = $name;
$this->gender = $gender;
}
public static function create()
{
return new self(0,'','');
}
public function graph()
{
return Entity::graph(
['Person']
)
->properties(
[
'id' => Type::Integer(),
'name' => Type::String(),
'gender' => Type::String()
]
);
}
}