cloudstek/scim-filter-parser

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

v3.0.0 2022-03-22 00:13 UTC

This package is auto-updated.

Last update: 2024-04-22 04:50:19 UTC


README

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.

  • Does not support SCIM v1.0 (only v2)
  • Does not come with a "dumper" to provide a nice textual representation of the AST. Instead you can use var_dump or VarDumper.