@@ -25,8 +25,8 @@ and query against an LDAP server.
2525
2626The ``Ldap `` class uses an :class: `Symfony\\ Component\\ Ldap\\ Adapter\\ AdapterInterface `
2727to 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
29- using the following options:
28+ for PHP's built-in LDAP extension, for example, can be configured using the
29+ following options:
3030
3131``host ``
3232 IP or hostname of the LDAP server
@@ -38,31 +38,39 @@ using the following options:
3838 The version of the LDAP protocol to use
3939
4040``encryption ``
41- The encryption protocol : ``ssl ``, ``tls `` or ``none `` (default)
41+ The encryption protocol: ``ssl ``, ``tls `` or ``none `` (default)
42+
43+ ``connection_string ``
44+ You may use this option instead of ``host `` and ``port `` to connect to the
45+ LDAP server
46+
47+ ``optReferrals ``
48+ Specifies whether to automatically follow referrals returned by the LDAP server
4249
4350``options ``
44- LDAP server's options as defined in :class: `ConnectionOptions <Symfony\\ Component\\ Ldap\\ Adapter\\ ExtLdap\\ ConnectionOptions> `
51+ LDAP server's options as defined in
52+ :class: `ConnectionOptions <Symfony\\ Component\\ Ldap\\ Adapter\\ ExtLdap\\ ConnectionOptions> `
4553
4654For example, to connect to a start-TLS secured LDAP server::
4755
48- use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter;
4956 use Symfony\Component\Ldap\Ldap;
5057
51- $adapter = new Adapter( array(
58+ $ldap = Ldap::create('ext_ldap', array(
5259 'host' => 'my-server',
53- 'port' => 389,
54- 'encryption' => 'tls',
55- 'options' => array(
56- 'protocol_version' => 3,
57- 'referrals' => false,
58- ),
60+ 'encryption' => 'ssl',
5961 ));
60- $ldap = new Ldap($adapter);
62+
63+ Or you could directly specify a connection string::
64+
65+ use Symfony\Component\Ldap\Ldap;
66+
67+ $ldap = Ldap::create('ext_ldap', array('connection_string' => 'ldaps://my-server:636'));
6168
6269The :method: `Symfony\\ Component\\ Ldap\\ Ldap::bind ` method
6370authenticates a previously configured connection using both the
6471distinguished name (DN) and the password of a user::
6572
73+ use Symfony\Component\Ldap\Ldap;
6674 // ...
6775
6876 $ldap->bind($dn, $password);
@@ -71,6 +79,7 @@ Once bound (or if you enabled anonymous authentication on your
7179LDAP server), you may query the LDAP server using the
7280:method: `Symfony\\ Component\\ Ldap\\ Ldap::query ` method::
7381
82+ use Symfony\Component\Ldap\Ldap;
7483 // ...
7584
7685 $query = $ldap->query('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))');
@@ -85,19 +94,21 @@ all entries in a single call and do something with the results'
8594array, you may use the
8695:method: `Symfony\\ Component\\ Ldap\\ Adapter\\ ExtLdap\\ Collection::toArray ` method::
8796
97+ use Symfony\Component\Ldap\Ldap;
8898 // ...
8999
90100 $query = $ldap->query('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))');
91101 $results = $query->execute()->toArray();
92102
93103 // Do something with the results array
94104
95- Creating or updating entries
105+ Creating or Updating Entries
96106----------------------------
97107
98- Since version 3.1, The Ldap component provides means to create
99- new LDAP entries, update or even delete existing ones::
108+ The Ldap component provides means to create new LDAP entries, update or even
109+ delete existing ones::
100110
111+ use Symfony\Component\Ldap\Ldap;
101112 use Symfony\Component\Ldap\Entry;
102113 // ...
103114
0 commit comments