Tools

Creation and modification of DN strings

Using the filter API to create search filters

Create simple LDAP filters

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$f1  = Zend\Ldap\Filter::equals('name', 'value');         // (name=value)
$f2  = Zend\Ldap\Filter::begins('name', 'value');         // (name=value*)
$f3  = Zend\Ldap\Filter::ends('name', 'value');           // (name=*value)
$f4  = Zend\Ldap\Filter::contains('name', 'value');       // (name=*value*)
$f5  = Zend\Ldap\Filter::greater('name', 'value');        // (name>value)
$f6  = Zend\Ldap\Filter::greaterOrEqual('name', 'value'); // (name>=value)
$f7  = Zend\Ldap\Filter::less('name', 'value');           // (name<value)
$f8  = Zend\Ldap\Filter::lessOrEqual('name', 'value');    // (name<=value)
$f9  = Zend\Ldap\Filter::approx('name', 'value');         // (name~=value)
$f10 = Zend\Ldap\Filter::any('name');                     // (name=*)

Create more complex LDAP filters

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
$f1 = Zend\Ldap\Filter::ends('name', 'value')->negate(); // (!(name=*value))

$f2 = Zend\Ldap\Filter::equals('name', 'value');
$f3 = Zend\Ldap\Filter::begins('name', 'value');
$f4 = Zend\Ldap\Filter::ends('name', 'value');

// (&(name=value)(name=value*)(name=*value))
$f5 = Zend\Ldap\Filter::andFilter($f2, $f3, $f4);

// (|(name=value)(name=value*)(name=*value))
$f6 = Zend\Ldap\Filter::orFilter($f2, $f3, $f4);

Modify LDAP entries using the Attribute API

Table Of Contents

Previous topic

Usage Scenarios

Next topic

Object-oriented access to the LDAP tree using Zend\Ldap\Node

This Page

Note: You need to stay logged into your GitHub account to contribute to the documentation.

Edit this document

Edit this document

The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.

  1. Login with your GitHub account.
  2. Go to Tools on GitHub.
  3. Edit file contents using GitHub's text editor in your web browser
  4. Fill in the Commit message text box at the end of the page telling why you did the changes. Press Propose file change button next to it when done.
  5. On Send a pull request page you don't need to fill in text anymore. Just press Send pull request button.
  6. Your changes are now queued for review under project's Pull requests tab on GitHub.