Cloudstek / scim-filter-parser

Parser for the SCIM (IETF RFC 7644, System for Cross-domain Identity Management) filter language.
https://cloudstek.github.io/scim-filter-parser-docs/index.html
MIT License
8 stars 4 forks source link
parser scim scim-filter

SCIM Filter Parser

Parser for the SCIM (IETF RFC 7644, System for Cross-domain Identity Management) filter syntax.

GitHub Workflow Status Coverage Status Scrutinizer Code Quality GitHub GitHub tag (latest SemVer) Packagist Downloads Packagist Stars

Installation

This library is available as composer package and this is the recommended way to install this library.

$ composer require cloudstek/scim-filter-parser

Manual installation

If you don't use composer, you can install this library manually using the following steps:

  1. Clone this repository or download the latest release from the releases page.
  2. Require all files manually or use a PSR-4 autoloader (recommended).

Usage

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 ...

Issues

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.

Known limitations

At the moment there are a few limitations to be aware of, though in the future these may be addressed.