PHPackages                             anthonyedmonds/laravel-ldap-emulator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. anthonyedmonds/laravel-ldap-emulator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

anthonyedmonds/laravel-ldap-emulator
====================================

Automatically boot an LDAP emulator while working in a local environment.

3.0.2(11mo ago)19.5k↓81.6%MITPHPPHP ^8

Since Apr 26Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/AnthonyEdmonds/laravel-ldap-emulator)[ Packagist](https://packagist.org/packages/anthonyedmonds/laravel-ldap-emulator)[ Docs](https://github.com/AnthonyEdmonds/laravel-ldap-emulator)[ RSS](/packages/anthonyedmonds-laravel-ldap-emulator/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (3)Versions (18)Used By (0)

Laravel LDAP Emulator
=====================

[](#laravel-ldap-emulator)

Automatically boot an LDAP emulator while working in a local environment.

Built for [Laravel](https://laravel.com/).

Based on the LDAP emulation provided by [LDAP Record](https://ldaprecord.com/).

Supports roles provided by [Spatie's Laravel Permission](https://spatie.be/docs/laravel-permission).

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

[](#installation)

Add the library via Composer: `composer require anthonyedmonds/laravel-ldap-emulator --dev`

Add the `LdapEmulatorServiceProvider` to `bootstrap/providers.php`:

```
use AnthonyEdmonds\LaravelLdapEmulator\Providers\LdapEmulatorServiceProvider;

return [
    ...
    LdapEmulatorServiceProvider::class,
    ...
];
```

If you are manually loading service providers, `LdapEmulatorServiceProvider` must be loaded after `LdapRecord\Laravel\LdapServiceProvider`.

Once installed, export the config: `php artisan vendor:publish --provider="AnthonyEdmonds\LaravelLdapEmulator\Providers\LdapEmulatorServiceProvider"`

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

[](#configuration)

All configuration can be performed in the published `config/ldap-emulator.php` file.

Config Key.env keyExpectedDescriptionenabledLDAP\_EMULATOR\_ENABLEDboolWhether the emulator is enabledlaravel-user-modelstringThe fully qualified name of the Laravel User modellaravel-username-keystringWhich attribute is used to identify the local UserpasswordstringWhat to set the default local password toldap-user-modelstringThe fully qualified name of the LdapRecord User modelldap-username-keystringWhich attribute is used to identify the LDAP UserusersarrayThe users to add to LDAP and the local systemFurther instructions on setting up users are provided in the comments.

- Keep the total number of users to a minimum for efficiency
- You may create a mixture of users which are automatically imported or left in active directory
- You may only assign roles to automatically imported users

Usage
-----

[](#usage)

When the `APP_ENV` key of your system is set to `local` an LDAP emulator instance is started.

Beyond configuring the pool of users to add, the system will operate as if it had an LDAP server connected.

Imported users will not be updated once they have been created, however they can be synced when they sign in if LdapRecord is set up to do so.

Note that there some limitations to the functionality of the emulator, which are [described here](https://ldaprecord.com/docs/laravel/v2/testing/#directory-emulator).

Authentication
--------------

[](#authentication)

When a call to `Auth::attempt()` is made, the `Attempting` event is fired and the LdapUser attempting to log in will be allowed to sign-in.

If you use a library that first calls `Auth::validate()`, such as Laravel Fortify, you will need to call the `setActingUser()` method first:

```
Fortify::authenticateUsing(function ($request) {
    if (config('ldap-emulator.enabled') === true) {
        LdapEmulatorServiceProvider::setActingUser($request->username);
    }

    $validated = Auth::validate([
        'samaccountname' => $request->username,
        'password' => $request->password,
    ]);

    return $validated ? Auth::getLastAttempted() : null;
});
```

Roadmap
-------

[](#roadmap)

Raise a ticket with your ideas and suggestions, or raise a pull request with your contributions.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance51

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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.

###  Release Activity

Cadence

Every ~74 days

Recently: every ~116 days

Total

17

Last Release

346d ago

Major Versions

1.3.0 → 2.0.02024-04-15

2.0.2 → 3.0.02025-04-14

PHP version history (3 changes)1.0.0PHP ^8

1.3.0PHP ^8.2

2.0.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17785811?v=4)[Anthony Edmonds](/maintainers/AnthonyEdmonds)[@AnthonyEdmonds](https://github.com/AnthonyEdmonds)

---

Top Contributors

[![AnthonyEdmonds](https://avatars.githubusercontent.com/u/17785811?v=4)](https://github.com/AnthonyEdmonds "AnthonyEdmonds (37 commits)")

---

Tags

laravelldapactive directoryemulator

### Embed Badge

![Health badge](/badges/anthonyedmonds-laravel-ldap-emulator/health.svg)

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

###  Alternatives

[symfony/ldap

Provides a LDAP client for PHP on top of PHP's ldap extension

1408.1M59](/packages/symfony-ldap)[venturedrake/laravel-crm

A free open source CRM built as a package for laravel projects

43411.2k](/packages/venturedrake-laravel-crm)[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.4k](/packages/typicms-base)[adldap/adldap

A PHP LDAP Library for Active Directory Manipulation

424171.8k9](/packages/adldap-adldap)

PHPackages © 2026

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