PHPackages                             queencitycodefactory/ldap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. queencitycodefactory/ldap

ActiveCakephp-plugin[Authentication &amp; Authorization](/categories/authentication)

queencitycodefactory/ldap
=========================

LDAP plugin for CakePHP 3.x

3.3.4(2y ago)139.6k—0%31MITPHPPHP &gt;=5.5.9

Since Nov 6Pushed 2y ago6 watchersCompare

[ Source](https://github.com/QueenCityCodeFactory/LDAP)[ Packagist](https://packagist.org/packages/queencitycodefactory/ldap)[ Docs](http://github.com/QueenCityCodeFactory/LDAP)[ RSS](/packages/queencitycodefactory-ldap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (16)Used By (1)

LDAP Authenticate plugin
========================

[](#ldap-authenticate-plugin)

LDAP Authenticate Plugin for CakePHP 3.x and AuthComponent.

Requirements
------------

[](#requirements)

- CakePHP 3.0
- php5-ldap module or
- php7.0-ldap module

Installation
------------

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

The recommended way to install composer packages is:

```
composer require queencitycodefactory/ldap

```

You can also add `"queencitycodefactory/ldap" : "dev-master"` to `require` section in your application's `composer.json`.

Usage
-----

[](#usage)

Include the CakeSoap library files:

```
    use Ldap\Auth\LdapAuthenticate;
```

Configuration:
--------------

[](#configuration)

Setup the authentication class settings

### AppController Setup:

[](#appcontroller-setup)

```
    public function initialize()
    {
        parent::initialize();
        $this->loadComponent('Flash');
        $this->loadComponent('Auth', [
            'loginAction' => [
                'controller' => 'Users',
                'action' => 'login'
            ],
            'authError' => 'Insufficient privileges to view requested resources. Please login to continue!',
            'authenticate' => [
                'Ldap.Ldap' => Configure::read('Ldap') + [
                    'fields' => [
                        'username' => 'username',
                        'password' => 'password'
                    ],
                    'flash' => [
                        'key' => 'ldap',
                        'element' => 'Flash/error',
                    ]
                ]
            ]
        ]);
    }
```

### Setting the Base LDAP settings

[](#setting-the-base-ldap-settings)

config/app.php:

```
    /**
     * LDAP Configuration.
     *
     * Contains an array of settings to use for the LDAP configuration.
     *
     * ## Options
     *
     * - `domain` - The domain name to match against or auto complete so user isn't
     *    required to enter full email address
     * - `host` - The domain controller hostname. This can be a closure or a string.
     *    The closure allows you to modify the rules in the configuration without the
     *    need to modify the LDAP plugin. One host (string) should be returned when
     *    using closure.
     * - `baseDN` - The base DN for directory - Closure must be used here, the plugin
     *    is expecting a closure object to be set.
     * - `bindDN` - The bind DN for directory - Closure must be used here, the plugin
     *    is expecting a closure object to be set.
     * - `search` - The attribute to search against. Usually 'UserPrincipalName'
     * - `port` - The port to use. Default is 389 and is not required.
     * - `errors` - Array of errors where key is the error and the value is the error
     *    message. Set in session to Flash.ldap for flashing
     * - `logErrors` - Should the errors be logged
     * - `options` - Array of options to set using ldap_set_option
     *
     * @link http://php.net/manual/en/function.ldap-search.php - for more info on ldap search
     */
    'Ldap' => [
        'domain' => 'example.com',
        'alternateDomains' => [
            'anotherexample.com',
            'example2.com',
        ],
        'host' => function() {
            $hosts = ['192.168.1.13', '127.0.0.1'];
            shuffle($hosts);
            return $hosts[0];
        },
        //'host' => '127.0.0.1',
        'port' => 389,
        'search' => function($username) {
            return '(UserPrincipalName=' . $username . ')';
        },
        'searchAttributes' => ['*', 'memberof'],
        'baseDN' => function($username, $domain) {
            if (strpos($username, $domain) !== false) {
                $baseDN = 'OU=example,DC=domain,DC=local';
            } else {
                $baseDN = 'CN=Users,DC=domain,DC=local';
            }
            return $baseDN;
        },
        'bindDN' => function($username, $domain) {
            $bindDN = "CN=".$username.", OU=example";
            return $bindDN;
        },
        'errors' => [
            'data 773' => 'Some error for Flash',
            'data 532' => 'Some error for Flash',
        ],
        'logErrors' => true,
        'options' => [
            LDAP_OPT_NETWORK_TIMEOUT => 5,
            LDAP_OPT_PROTOCOL_VERSION => 3,
        ]
    ]
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 73% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~197 days

Recently: every ~202 days

Total

15

Last Release

1083d ago

Major Versions

1.1 → 3.22016-03-26

PHP version history (2 changes)1.0PHP &gt;=5.4.16

3.2PHP &gt;=5.5.9

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/840593?v=4)[Daren Sipes](/maintainers/darensipes)[@darensipes](https://github.com/darensipes)

![](https://www.gravatar.com/avatar/b7e68b41ed883ad7120b0190b7b30f12d868e6c2bfccd4c7ad7a673476a6b079?d=identicon)[jrble819](/maintainers/jrble819)

![](https://avatars.githubusercontent.com/u/480903?v=4)[Miguel Sainz Jr.](/maintainers/themogwi)[@themogwi](https://github.com/themogwi)

---

Top Contributors

[![darensipes](https://avatars.githubusercontent.com/u/840593?v=4)](https://github.com/darensipes "darensipes (27 commits)")[![jrble819](https://avatars.githubusercontent.com/u/755205?v=4)](https://github.com/jrble819 "jrble819 (6 commits)")[![joshrhykerd](https://avatars.githubusercontent.com/u/227919?v=4)](https://github.com/joshrhykerd "joshrhykerd (3 commits)")[![watermark](https://avatars.githubusercontent.com/u/1056975?v=4)](https://github.com/watermark "watermark (1 commits)")

---

Tags

cakephpldapauthenticate

### Embed Badge

![Health badge](/badges/queencitycodefactory-ldap/health.svg)

```
[![Health](https://phpackages.com/badges/queencitycodefactory-ldap/health.svg)](https://phpackages.com/packages/queencitycodefactory-ldap)
```

###  Alternatives

[admad/cakephp-jwt-auth

CakePHP plugin for authenticating using JSON Web Tokens

160680.3k8](/packages/admad-cakephp-jwt-auth)[xety/cake3-cookieauth

A simple Cake3 plugin to authenticate users with Cookies.

1954.7k2](/packages/xety-cake3-cookieauth)[uafrica/oauth-server

OAuth Server for CakePHP 3 using the PHP League's OAuth2 Server

5172.1k](/packages/uafrica-oauth-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
