This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
You can install the package via composer:
composer require zymawy/dgraph
You can publish and run the migrations with:
php artisan vendor:publish --tag="dgraph-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="dgraph-config"
This is the contents of the published config file:
return [
];
Optionally, you can publish the views using
php artisan vendor:publish --tag="dgraph-views"
use Zymawy\Dgraph\DgraphClient;
/** @var DgraphClient $client */
$client = new DgraphClient('http://localhost:8080');
use Zymawy\Dgraph\Api\Operation;
use Zymawy\Dgraph\Exceptions\DgraphException;
use Zymawy\Dgraph\Types\StringType;
use Zymawy\Dgraph\Types\IntType;
use Zymawy\Dgraph\DgraphClient;
/** @var DgraphClient $client */
$client = new DgraphClient('http://localhost:8080');
// Define the schema using the Operation class
$operation = new Operation();
$operation
->addField("name", new StringType(["index(term)"]))
->addField("age", new IntType(["index(int)"]))
->addType("person", ["name", "age"]);
try {
$response = $client->alter($operation);
if ($response->hasErrors()) {
throw new DgraphException("Schema alteration error: " . json_encode($response->getErrors()));
} else {
echo "Schema successfully altered.";
}
} catch (DgraphException $e) {
echo "Error: " . $e->getMessage();
}
use Zymawy\Dgraph\DgraphClient;
use Zymawy\Dgraph\Txn;
use Zymawy\Dgraph\Responses\DgraphResponse;
use Zymawy\Dgraph\Exceptions\DgraphException;
use Zymawy\Dgraph\Types\StringType;
use Zymawy\Dgraph\Types\IntType;
/** @var DgraphClient $client */
$client = new DgraphClient("http://localhost:8080");
use Zymawy\Dgraph\Api\Mutation;
use Zymawy\Dgraph\Exceptions\DgraphException;
/** @var DgraphClient $client */
$client = new DgraphClient("http://localhost:8080");
$mutation = new Mutation();
$mutation->set([
[
"uid" => "_:account1",
"name" => "Hamza",
"balance" => 1000.0
],
[
"uid" => "_:account2",
"name" => "Zymawy",
"balance" => 500.0
]
]);
try {
$response = $client->mutate($mutation, true); // commitNow set to true
if ($response->hasErrors()) {
throw new DgraphException(
"Mutation error: " . json_encode($response->getErrors())
);
} else {
print_r($response->getData());
}
} catch (DgraphException $e) {
echo "Error: " . $e->getMessage();
}
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.