2017 © Pedro Peláez
 

library ldaph

poor man's php ldap class

image

comodojo/ldaph

poor man's php ldap class

  • Monday, January 29, 2018
  • by comodojo
  • Repository
  • 3 Watchers
  • 0 Stars
  • 698 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 49 % Grown

The README.md

comodojo.ldaph

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality Code Coverage, (*1)

poor man's php ldap class, (*2)

Ldaph is a simple library made to handle LDAP/ActiveDirectory authentication and search., (*3)

It supports:, (*4)

  • ssl (ldaps)
  • tls
  • single sign on (Active Directory)

Installation

Install composer, then:, (*5)

composer require comodojo/ldaph 1.0.*, (*6)

Basic Usage

  • Creating an instance, (*7)

    Class constructor expects ldap server and port as parameters. Wrap it in a try/catch block, since it may generate a LdaphException in case of wrong parameters or missed php ext., (*8)


    try { $ldap = new \Comodojo\Ldaph('ldap.exampe.com', 389); } catch (LdaphException $le){ // handle exception here }
  • User authentication, (*9)


    $dn = "uid=john,dc=example,dc=com"; try { $ldap = new \Comodojo\Ldaph('ldap.exampe.com', 389); $lauth = $ldap->dn($dn)->auth('john', 'doe'); } catch (LdaphException $le){ // handle exception here }

    Defining DN, there is a special word USERNAME that will be replaced with first auth() parameter ($username)., (*10)

    Examples of DN:, (*11)

    • "USERNAME@example.com" (for Active Directory)
    • "uid=USERNAME,dc=example,dc=com" (for openLDAP)
  • Search LDAP tree, (*12)

    Searching into ldap tree requires, at least:, (*13)

    • base DN (base)
    • search DN (searchbase)
    • bind DN (dn)
    • account (user/pass)

    search() method will list ldap tree using this parameters., (*14)


    $dn = "uid=USERNAME,dc=example,dc=com"; $base = "dc=example,dc=com"; $searchbase = "(uid=PATTERN)"; try { $ldap = new \Comodojo\Ldaph('ldap.exampe.com', 389); $lsearch = $ldap->base($base) ->searchbase($searchbase) ->dn($dn) ->account('john', 'doe') ->search("*",true); } catch (LdaphException $le){ // handle exception here }

    Special word 'PATTERN' in searchbase will be replaced with first search() parameter., (*15)

    Second parameter (if true) will return results in a more convenient, array-based form., (*16)

    Examples of searchbase (if you are looking for usernames):, (*17)

    • "(&(!(objectClass=computer))(|(anr=PATTERN)))" (for Active Directory)
    • "(uid=PATTERN)" (for openLDAP)

Documentation

Contributing

Contributions are welcome and will be fully credited. Please see CONTRIBUTING for details., (*18)

License

comodojo/ldaph is released under the MIT License (MIT). Please see License File for more information., (*19)

The Versions

29/01 2018

dev-master

9999999-dev https://comodojo.org

poor man's php ldap class

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication php sso ldap active directory ldaps directory search

29/01 2018

1.0.x-dev

1.0.9999999.9999999-dev https://comodojo.org

poor man's php ldap class

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication php sso ldap active directory ldaps directory search

29/01 2018

1.0.2

1.0.2.0 https://comodojo.org

poor man's php ldap class

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication php sso ldap active directory ldaps directory search

11/08 2015

1.0.1

1.0.1.0 https://comodojo.org

poor man's php ldap class

  Sources   Download

MIT

The Requires

 

The Development Requires

authentication php sso ldap active directory ldaps directory search

07/05 2015

1.0.0

1.0.0.0 http://comodojo.org

poor man's php ldap class

  Sources   Download

MIT

The Requires

  • php >=5.1.3
  • ext-ldap *

 

The Development Requires

authentication php sso ldap active directory ldaps directory search