railken / lara-eye
Installs: 38 665
Dependents: 4
Suggesters: 0
Security: 0
Stars: 38
Watchers: 4
Forks: 2
Open Issues: 0
Requires
- php: >=8.1
- illuminate/database: 9.* || 10.*
- railken/bag: ^2.0
- railken/search-query: 3.*
Requires (Dev)
README
Filter your Illuminate\DataBase\Query\Builder
using a structured query language.
This can be pretty usefull when you're building an API and you don't want to waste hours of your time creating predefined filters that may change at any time.
Requirements
PHP 8.1 or later.
Usage
use Railken\LaraEye\Filter; use Railken\SQ\Exceptions\QuerySyntaxException; use App\Foo; // Instance of Illuminate\DataBase\Query\Builder $query = (new Foo())->newQuery()->getQuery(); $str_filter = "x > 5 or y < z"; $filter = new Filter("foo", ['id', 'x', 'y', 'z', 'created_at', 'updated_at']); try { $filter->build($query, $str_filter); } catch (QuerySyntaxException $e) { // handle syntax error }
Syntax here
Composer
You can install it via Composer by typing the following command:
composer require railken/lara-eye
Demo
License
Open-source software licensed under the MIT license.