aaronbullard / eads
PHP Utility for EADS APIs
Installs: 12 106
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^7.0
Requires (Dev)
- phpunit/phpunit: ^6.4
This package is auto-updated.
Last update: 2024-10-15 01:21:11 UTC
README
EADS Utility
PHP Utility for Enterprise APIs for Data Sharing Standard
Filtering
This is a helper class to translate a string of filters into usable sql.
Example query:
?filters=status==verified,age>18,weight>=<150;200
This query translates to:
- WHERE status = 'verified'
- AND age > 18
- AND weight BETWEEN 150 AND 200
Installation
composer require aaronbullard/eads
Usage
See the tests for usage and examples /tests
// GET `?filters=status==verified,age>18,weight>=<150;200` $filterString = Request::get('filters'); $parser = new EADS\Filters\Parser($filterString); // Get first query $filter = $parser->getFilters()[0]; $sql = $filter->getSQL(); // "status = ?" $bindings = $filter->getBindings(); // ['verified']
or
// GET `?filters=status==verified,age>18,weight>=<150;200` $filterString = Request::get('filters'); $filters = EADS::filters($filterString); // Get first query $filter = $filters[0]; $sql = $filter->getSQL(); // "status = ?" $bindings = $filter->getBindings(); // ['verified']
License
The package is available as open source under the terms of the MIT License.