PHPackages                             pletfix/ldap-plugin - 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. pletfix/ldap-plugin

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

pletfix/ldap-plugin
===================

LDAP Plugin for Pletfix

15PHP

Since Oct 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/pletfix/ldap-plugin)[ Packagist](https://packagist.org/packages/pletfix/ldap-plugin)[ RSS](/packages/pletfix-ldap-plugin/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

LDAP Plugin for Pletfix
=======================

[](#ldap-plugin-for-pletfix)

About This
----------

[](#about-this)

This plugin provides a LDAP service to authenticate the user through the Active Directory.

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

[](#installation)

Fetch the package by running the following terminal command under the application's directory:

```
composer require pletfix/ldap-plugin

```

After downloading, enter this command in your terminal to register the plugin:

```
php console plugin pletfix/ldap-plugin

```

Environment and Configuration
-----------------------------

[](#environment-and-configuration)

Add the following environment variables in your `.env` file:

```
LDAP_ACCOUNT_SUFFIX=YourYccountSuffix
LDAP_DOMAIN_CONTROLLER_1=YourPrimaryDC
LDAP_DOMAIN_CONTROLLER_2=YourSecondDC
LDAP_BASE_DN=YouBaseDN

```

At the next, open the configuration file `./config/ldap.php` under the application's directory and override the defaults if you wish.

Customize
---------

[](#customize)

### View

[](#view)

If you would like to modified the views of the plugin, create a folder `ldap` under the view directory of the application, and copy the views there. Here you can edit the views as you like:

```
mkdir ./resources/views/ldap
cp -R ./vendor/pletfix/ldap-plugin/views/* ./resources/views/ldap

```

If you have installed the [Pletfix Application Skeleton](https://github.com/pletfix/app), you could add the necessary menu items ("login" and "logout") by including the partial `_nav` in your `resources/views/app.blade.php` layout just above the marker `{{--menu_point--}}`:

```
   @include('ldap._nav')

```

### Routes

[](#routes)

If you like to use another route paths, copy the route entries from `./vendor/pletfix/ldap-plugin/boot/routes.php`into the application's routing file `./boot/routes.php`, where you can modify them as you wish:

```
$route->get('ldap/login',  'LdapController@showForm');
$route->post('ldap/login', 'LdapController@login');

```

Usage
-----

[](#usage)

### User Authentication

[](#user-authentication)

Enter the following URL into your Browser to open the login form:

```
https:///ldap/login

```

[![Screenshot1](https://raw.githubusercontent.com/pletfix/ldap-plugin/master/screenshot1.png)](https://raw.githubusercontent.com/pletfix/ldap-plugin/master/screenshot1.png)

#### User Role

[](#user-role)

The "memberof" attribute is used to determine the user role. You may edit the member mapping in the configuration file `config/ldap`.

#### User Model

[](#user-model)

If you have defined a user model in the configuration, the user attributes are stored in the database. By default, the user model from the [Pletfix Application Skeleton](https://github.com/pletfix/app) is used and no further migration is required.

#### Logout

[](#logout)

You may invoke just the following command to logout the user:

```
auth()->logout();

```

### LDAP Service

[](#ldap-service)

#### Accessing the LDAP service

[](#accessing-the-ldap-service)

You can get an instance of the LDAP Service from the Dependency Injector:

```
/** @var Pletfix\Ldap\Services\Contracts\Ldap $ldap */
$ldap = DI::getInstance()->get('ldap');

```

You can also use the `ldap()` function to get the LDAP service, it is more comfortable:

```
$ldap = ldap();

```

#### Available Methods

[](#available-methods)

#### `search()`

[](#search)

Search LDAP tree and get all result entries.

```
$users = $ldap->search('userprincipalname=Fr*');

```

#### `getUsers()`

[](#getusers)

Get the user entries.

```
$users = $ldap->getUsers();

```

You may also set a filter for the `userprincipalname` attribute:

```
$users = $ldap->getUsers('Fr*');

```

#### `getUser()`

[](#getuser)

Get the user attributes by given username (userPrincipalName or samAccountName).

```
$user = $ldap->getUser('FrankR');

```

You may define the attributes of the user in the configuration file `config/ldap`.

#### `authenticate()`

[](#authenticate)

Authenticate the user through the Active Directory.

```
$isAuthenticated = $ldap->authenticate($username, $password);

```

#### `getErrorCode()`

[](#geterrorcode)

Return the LDAP error code of the last LDAP command.

```
$errorCode = $ldap->getErrorCode();

```

#### `getErrorMessage()`

[](#geterrormessage)

Return the LDAP error message of the last LDAP command.

```
$errorMessage = $ldap->getErrorMessage();

```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/64489babc88aa87c56b4097f2a4fe20233d1a3ee63ce0da7c2cc2f97a883f444?d=identicon)[frohlfing](/maintainers/frohlfing)

---

Top Contributors

[![frohlfing](https://avatars.githubusercontent.com/u/9631952?v=4)](https://github.com/frohlfing "frohlfing (19 commits)")

### Embed Badge

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

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

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.2M17](/packages/kartik-v-yii2-password)

PHPackages © 2026

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