1. Go to this page and download the library: Download drewlabs/rest-query 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/ */
drewlabs / rest-query example snippets
use Drewlabs\RestQuery\QueryBuilder;
// ...
// Building the query and using the query builder fluent API
$builder = QueryBuilder::new()
->eq('title', 'Lorem Ipsum')
->neq('id', 10)
->where(function (QueryBuilder $builder) {
return $builder->in('tags', ['I', 'L', 'F'])
->gt('likes', 120)
->gte('groups', 10);
});
// Compiling the query output to JSON string
$result = $builder->json();