Skip to content

sergey-ben/eads

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maintainability

EADS Utility

PHP Utility for Enterprise APIs for Data Sharing Standard

https://eads.540.co/

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.

About

PHP Utility for EADS APIs

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • PHP 100.0%