PHP code example of digitalcharacter / filter-collection
1. Go to this page and download the library: Download digitalcharacter/filter-collection library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
digitalcharacter / filter-collection example snippets
use dc\Filter\Collection;
$collection = new Collection(Collection::LOGICAL_AND);
$collection = new Collection(Collection::LOGICAL_OR);
$collection = new Collection(Collection::LOGICAL_XAND);
$collection = new Collection(Collection::LOGICAL_XOR);
use dc\Filter\Collection;
$parent = new Collection();
$child = new Collection(Collection::LOGICAL_AND, $parent);
use dc\Filter\Collection;
$collection = new Collection();
//Equal
$collection->addEqual('key', 'value');
//Not Equal
$collection->addNotEqual('key', 'value');
//Exists
$collection->addExists('key', true);
//Greater Than
$collection->addGreaterThan('key', 1);
//Greater Than Equal
$collection->addGreaterThanEqual('key', 1);
//Lower Than
$collection->addLowerThan('key', 1);
//Lower Than Equal
$collection->addLowerThanEqual('key', 1);
//In
$collection->addIn('key', [1,2,3]);
//Not In
$collection->addNotIn('key', [1,2,3]);
//Query
$collection->addQuery('key', '%value%');
//Regex
$collection->addRegex('key', '/value/');
//Custom Filter
$collection->addCustomFilter('key', 'value', 'find_in_set');
use dc\Filter\Collection;
$collection = new Collection();
$collection->addEqual('user', '[email protected]')
->addEqual('active', 1)
->addCollection(Collection::LOGICAL_OR)
->addEqual('role', 'admin')
->addEqual('role', 'superadmin')
->parent()
->addCollection(Collection::LOGICAL_XAND)
->addEqual('foo', 'bar');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.