PHP code example of keboola / filter

1. Go to this page and download the library: Download keboola/filter 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/ */

    

keboola / filter example snippets


use Keboola\Filter\Filter;

// Compare the `shoeSize` property of John
$john = new \stdClass();
$john->shoeSize = 45;
$filter = FilterFactory::create("shoeSize>42");
$filter->compareObject($john); // true

// Multiple conditions can be used
$filter = FilterFactory::create("field1==0&field2!=0");
$object = (object) [
    'field1' => 0,
    'field2' => 1
];
$result = $filter->compareObject($object); // true

use Keboola\Filter\Filter;

// Compare the `shoeSize` property of John
$john = new \stdClass();
$john->name = "Johnny";
$filter = FilterFactory::create("name~~Johnny");
$filter->compareObject($john); // true