2017 © Pedro Peláez
 

library ldap

PHP LDAP library functionality packed in a simple class

image

stepansib/ldap

PHP LDAP library functionality packed in a simple class

  • Tuesday, February 13, 2018
  • by stepansib
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,694 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 25 Versions
  • 19 % Grown

The README.md

PHP LDAP library functionality packed in a simple class

SensioLabs Insight Codacy Packagist, (*1)

1. Installation

Run in your project directory:, (*2)

composer require stepansib/ldap

2. Usage

1. LDAP object

To configure connection instantiate LDAP object with connection params array:, (*3)

use StepanSib\LDAP\LDAP;

$ldap = new LDAP2(array(
    'host' => 'server.company.com',
    'username' => 'johndoe',
    'password' => '12345',
    'domain' => 'Company',
    'base_dn' => 'DC=Company,DC=com',
    'anonymous' => false,               // Optional parameter
    'can_login_via_shortname' => true,  // Optional parameter, set to false if your LDAP instance requires authentication by full qualified name
));

2. Connection

To connect and bind to LDAP:, (*4)

$ldap->connect();

Usage of this method is not necessary because connection will be established automatically when it will needed, (*5)

3. User authentication

To authenticate any account:, (*6)

$ldap->authenticate("jdoe", "12345");
$ldap->authenticate("johndoe@company.com", "12345");
$ldap->authenticate("John Doe", "12345");

The username credential can be any of following LDAP entry parameters: - cn - mail - displayname - name - sAMAccountName, (*7)

To find any record in LDAP directory use the following search method. You need to specify filter string, baseDN string and array of parameters you want to get per entry:, (*8)

$filter = '(memberOf=CN=Company Management,CN=Users,DC=Company,DC=com)';
//$filter = '&(objectClass=user)(sAMAccountName=jdoe))'; // any valid filter can be passed
$baseDn = 'DC=Company,DC=com';

$data = $ldap->search(
    $filter,
    array(
        'cn',
        'distinguishedname',
        'displayname',
        'department',
        'title',
        'sAMAccountName',
        'mail',
        'displayName'
    ),
    $baseDn,
);

The method returns assoc array with matched entries and their parameters values, (*9)

5. Close connection

After things was done you need to close connection:, (*10)

$ldap->close();

The Versions

13/02 2018

dev-master

9999999-dev

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

13/02 2018

v2.4.0

2.4.0.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

13/02 2018

v2.3.0

2.3.0.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

11/10 2017

v2.2.7

2.2.7.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

11/10 2017

v2.2.6

2.2.6.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

11/10 2017

v2.2.5

2.2.5.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

10/10 2017

v2.2.4

2.2.4.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

06/10 2017

v2.2.3

2.2.3.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

14/04 2016

dev-develop

dev-develop

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

14/04 2016

v2.2.2

2.2.2.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

08/04 2016

v2.2.1

2.2.1.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

08/04 2016

v2.2.0

2.2.0.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

07/04 2016

v2.1.0

2.1.0.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

31/03 2016

v2.0.3

2.0.3.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

31/03 2016

v2.0.2

2.0.2.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

23/03 2016

v2.0.1

2.0.1.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

23/03 2016

v2.0.0

2.0.0.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

MIT

The Requires

 

by Stepan Yudin

07/09 2015

v1.3.0

1.3.0.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

by Stepan Yudin

07/09 2015

v1.2.2

1.2.2.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

by Stepan Yudin

07/09 2015

v1.2.1

1.2.1.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

by Stepan Yudin

07/09 2015

v1.2.0

1.2.0.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

by Stepan Yudin

04/09 2015

v1.1.0

1.1.0.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

by Stepan Yudin

02/09 2015

v1.0.3

1.0.3.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

by Stepan Yudin

02/09 2015

v1.0.1

1.0.1.0

PHP LDAP library functionality packed in a simple class

  Sources   Download

by Stepan Yudin

02/09 2015

v1.0.0

1.0.0.0

Ldap utilities, authentication and searching

  Sources   Download

by Stepan Yudin