php-extended/php-ldap-dn-object

A library that implements the php-ldap-dn-interface library

4.0.0 2022-05-31 07:54 UTC

README

A library that implements the php-ldap-dn-interface library

coverage build status

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

	"require": {
		...
		"php-extended/php-ldap-dn-object": "^3"
		...
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

Basic Usage

This library creates dn with the following constructor :


use PhpExtended\Ldap\LdapDistinguishedName;

$ldn = new LdapDistinguishedName([
	'c' => 'fr',
	'o' => 'foo',
	'ou' => 'bar',
	'cn' => 'baz',
]);

// gets "cn=baz,ou=bar,o=foo,c=fr"

To parse the distinguished names, do :


use PhpExtended\Ldap\LdapDistinguishedNameParser;

$parser = new LdapDistinguishedNameParser();
$ldn = $parser->parse('cn=baz,ou=bar,o=foo,c=fr');

$ldn->getStringRepresentation(); // gets "cn=baz,ou=bar,o=foo,c=fr"

License

MIT (See license file).