1. Go to this page and download the library: Download tmilos/scim-filter-parser 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/ */
tmilos / scim-filter-parser example snippets
$parser = new Parser(Mode::FILTER());
$node = $parser->parse('userType eq "Employee" and (emails co "example.com" or emails.value co "example.org")');
/*
walk the node...
Conjunction = {
ComparisonExpression => userType eq Employee
Disjunction => {
ComparisonExpression => emails co example.com
ComparisonExpression => emails.value co example.org
}
}
*/
$parser = new Parser(Mode::PATH());
$node = $parser->parse('members[value eq "2819c223-7f76-453a-919d-413861904646"].displayName');
/*
walk the node...
Path = {
ValuePath = {
AttributePath = 'members'
ComparisonExpression = value eq 2819c223-7f76-453a-919d-413861904646
}
AttributePath = displayName,
}
*/
$parser = new Parser(Mode::PATH());
$parser->parse('username'); // OK
$parser->parse('username eq "xxx"'); // throws ParseException - Col 8: Expected end of input, but got ' '
$parser = new Parser(Mode::FILTER, Version::V1());
$parser->parse('emails[type eq "work"]'); // throws ParseException - Col 6: Expected SP, got '['
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.