Skip to content

Client side (PHP)

Favre Anael edited this page May 18, 2017 · 3 revisions

The client side is built around a Builder similar (but lighter) to the Laravel Query Builder. This builder can be used to create a http query string matching the Api Filtering specifications.

Usage (example)

$builder = new Ifnot\ApiFiltering\Query\Builder();
$builder->where('my_column', '=', 'my_value');
$builder->orderBy('other_column');
echo $builder->toQueryString();

Will output : where[my_column][=]=my_value&order_by[other_column]=asc

Documentation

// Add a basic where clause to the filter.
Builder::where($column, $operator = null, $value = null)

// Add a where between statement to the filter.
Builder::whereBetween($column, array $values)

// Add a where not between statement to the filter.
Builder::whereNotBetween($column, $values)

// Add a "where in" clause to the filter.
Builder::whereIn($column, $values)

// Add a "where not in" clause to the filter.
Builder::whereNotIn($column, $values)

// Add an "order by" clause to the filter.
Builder::orderBy($column, $direction = 'asc')

// Set the "limit" value of the filter.
Builder::limit($value)

// Set the "offset" value of the filter.
Builder::offset($value)
Clone this wiki locally