1. Go to this page and download the library: Download nahid/qarray 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/ */
nahid / qarray example snippets
class JsonQueryEngine extends \Nahid\QArray\QueryEngine
{
public function readPath($path)
{
$data = file_get_contents($path);
return json_decode($data, true);
}
public function parseData($data)
{
return json_decode($data, true);
}
}
class Product
{
protected $query;
public function __construct(\Nahid\QArray\QueryEngine $query)
{
$this->query = $query;
}
public function getMacbook()
{
try {
return $this->query
->from('.')
->where('cat', 2)
->get();
} catch (\Exception $e) {
return false;
}
}
}
$data = new JsonQueryEngine('data.json');
$query = new SomethingBuilder($data);
dump($query->getMacbook()->toArray());
$q = new Jsonq('data.json');
$res = $q->from('users')->where('id', '=', 1)->get();