wtf/middleware-filters

This package is abandoned and no longer maintained. No replacement package was suggested.

Built for wtf/orm

1.0.6 2020-12-03 14:14 UTC

This package is auto-updated.

Last update: 2024-10-29 07:44:16 UTC


README

Built for ORM package

Table of Contents

Installation

composer require wtf/middleware-filters

Add new middleware to your provider:

<?php

$container['middleware_filters'] = function ($c) {
    return new \Wtf\Middleware\Filters($c);
};

Add it to your suit.php middleware list:

<?php
//...
'middlewares' => [
//...
    'middleware_filters',
//...
],

Usage

Use medoo where conditions in your query, eg:

GET /?filter[name[~]]=Nich&limit=20&offset=20 => array:

<?php
[
    'name[~]' => 'Nich',
    'LIMIT' => [20,20],
];

And inside your code:

<?php

$collection = $this->entity('employee')->loadAll($this->container['filters']);