@@ -20,10 +20,12 @@ You can install the component in 2 different ways:
20
20
Usage
21
21
-----
22
22
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.
25
25
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
27
29
using the following options:
28
30
29
31
``host ``
@@ -47,24 +49,32 @@ using the following options:
47
49
48
50
For example, to connect to a start-TLS secured LDAP server::
49
51
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
55
67
authenticates a previously configured connection using both the
56
68
distinguished name (DN) and the password of a user::
57
69
58
- use Symfony\Component\Ldap\LdapClient;
59
70
// ...
60
71
61
72
$ldap->bind($dn, $password);
62
73
63
74
Once bound (or if you enabled anonymous authentication on your
64
75
LDAP 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::
66
77
67
- use Symfony\Component\Ldap\LdapClient;
68
78
// ...
69
79
70
80
$ldap->find('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))');
0 commit comments