@@ -20,10 +20,12 @@ You can install the component in 2 different ways:
2020Usage
2121-----
2222
23- The :class: `Symfony\\ Component\\ Ldap\\ LdapClient ` class provides methods
24- to authenticate and query against an LDAP server.
23+ The :class: `Symfony\\ Component\\ Ldap\\ Ldap ` class provides methods to authenticate
24+ and query against an LDAP server.
2525
26- The :class: `Symfony\\ Component\\ Ldap\\ LdapClient ` class can be configured
26+ The ``Ldap `` class uses an :class: `Symfony\\ Component\\ Ldap\\ Adapter\\ AdapterInterface `
27+ to communicate with an LDAP server. The :class: `adapter <Symfony\\ Component\\ Ldap\\ Adapter\\ ExtLdap\\ Adapter> `
28+ for PHP's built-in LDAP extension, for example, can be configured
2729using the following options:
2830
2931``host ``
@@ -47,24 +49,32 @@ using the following options:
4749
4850For example, to connect to a start-TLS secured LDAP server::
4951
50- use Symfony\Component\Ldap\LdapClient;
51-
52- $ldap = new LdapClient('my-server', 389, 3, false, true);
53-
54- The :method: `Symfony\\ Component\\ Ldap\\ LdapClient::bind ` method
52+ use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
53+ use Symfony\Component\Ldap\Ldap;
54+
55+ $adapter = new Adapter(array(
56+ 'host' => 'my-server',
57+ 'port' => 389,
58+ 'encryption' => 'tls',
59+ 'options' => array(
60+ 'protocol_version' => 3,
61+ 'referrals' => false,
62+ ),
63+ ));
64+ $ldap = new Ldap($adapter);
65+
66+ The :method: `Symfony\\ Component\\ Ldap\\ Ldap::bind ` method
5567authenticates a previously configured connection using both the
5668distinguished name (DN) and the password of a user::
5769
58- use Symfony\Component\Ldap\LdapClient;
5970 // ...
6071
6172 $ldap->bind($dn, $password);
6273
6374Once bound (or if you enabled anonymous authentication on your
6475LDAP server), you may query the LDAP server using the
65- :method: `Symfony\\ Component\\ Ldap\\ LdapClient ::find ` method::
76+ :method: `Symfony\\ Component\\ Ldap\\ Ldap ::find ` method::
6677
67- use Symfony\Component\Ldap\LdapClient;
6878 // ...
6979
7080 $ldap->find('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))');
0 commit comments