Parser for the SCIM (IETF RFC 7644, System for Cross-domain Identity Management) filter syntax.
This library is available as composer package and this is the recommended way to install this library.
$ composer require cloudstek/scim-filter-parser
If you don't use composer, you can install this library manually using the following steps:
As code often says more than a thousand words, a little code to get you started.
<?php
use Cloudstek\SCIM\FilterParser\FilterParser;
// Create the filter parser.
$filterParser = new FilterParser();
// Parse a filter string
$firstFilterAst = $filterParser->parse('userName eq "foobar"'); // Cloudstek\SCIM\FilterParser\AST\Comparison ...
// ... walk through the AST (abstract syntax tree) and do something with it.
// The parser is stateless so you can safely parse another filter if you like.
$secondFilterAst = $filterParser->parse('name[given eq "John" and family eq "Dough"]'); // Cloudstek\SCIM\FilterParser\AST\ValuePath ...
// Create the path parser.
$pathParser = new PathParser();
// Parse a path string, used in for example PATCH operations.
$pathAst = $pathParser->parse('name[given eq "John"].familyName'); // Cloudstek\SCIM\FilterParser\AST\ValuePath ...
Please report issues on the projects GitHub issues page and be sure to include information about your PHP version, library version, filter string and resulting AST.
At the moment there are a few limitations to be aware of, though in the future these may be addressed.