PHPackages                             ptdot/ldapauth - 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. ptdot/ldapauth

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

ptdot/ldapauth
==============

Laravel LDAP authentication wrapper

28PHP

Since Jul 22Pushed 7y ago3 watchersCompare

[ Source](https://github.com/pt-dot/ldap-auth)[ Packagist](https://packagist.org/packages/ptdot/ldapauth)[ RSS](/packages/ptdot-ldapauth/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel LDAP Authentication
===========================

[](#laravel-ldap-authentication)

Laravel LDAP Authentication is a package for authenticating user to Active Directory using **Lightweight Directory Access Protocol** and integrated with Laravel authenticatable model out of the box.

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

[](#requirements)

- Laravel 5.1 - 5.6
- Enable `PHP LDAP` Extension

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

[](#installation)

Install package through composer.

```
composer require ptdot/ldapauth
```

Next, if using Laravel under 5.5, include the service provider and Facade within your `config/app.php` file.

```
'providers' => [
    Ptdot\LdapAuth\LdapAuthServiceProvider::class,
],

'aliases' => [
    'LdapAuth' => Ptdot\LdapAuth\LdapAuthFacade::class,
]
```

Since Laravel 5.5+ is using Package Discovery, there is no need manually insert service provider and facade inside your `app.php`.

Configuration
-------------

[](#configuration)

Publish config using command:

```
php artisan vendor:publish --tag=config
```

Set keys and values for your LDAP configuration in `.env` file.

```
LDAP_HOST=ldap.example.com
LDAP_PORT=389
```

Setup your User model or custom authentication model In `config/ldap.php` file and don't forget to adjust your `usernameField` value from your authentication model.

> Make sure you are already has user data in database and create user model for authentication.

```
/*
    |--------------------------------------------------------------------------
    | Authentication user model
    |--------------------------------------------------------------------------
    |
    | Authentication is used User model for default.
    | Define this option if authentication model using different model / namespace.
    |
    */
    'user' => App\User::class,
    'usernameField' => 'username'
```

Usage
-----

[](#usage)

For attempting authentication using LDAP:

```
$result = LdapAuth::attempt($username, $password);
```

Attempt method will return an array that indicate that authentication is success or not.

**Example**

```
/**
* Logging in using LDAP
*/
public funtion login(Request $request)
{
    $username = $request->get('username');
    $password = $request->get('password');

    $login = LdapAuth::attempt($username, $password);
    if($login['status']) {
        return "Login success";
    }
    return "Login failed. Error: ".$login['message'];
}
```

Contributing
------------

[](#contributing)

Feel free to report an issue or merge request if you want to help this package become better and useful.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

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://avatars.githubusercontent.com/u/3158533?v=4)[Didik Tri Susanto](/maintainers/didikz)[@didikz](https://github.com/didikz)

---

Top Contributors

[![didikz](https://avatars.githubusercontent.com/u/3158533?v=4)](https://github.com/didikz "didikz (2 commits)")

---

Tags

authenticationlaravelldapphp

### Embed Badge

![Health badge](/badges/ptdot-ldapauth/health.svg)

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

###  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)
