directorytree/ldaprecord-laravel
Laravel integration for LdapRecord: authenticate and sync users against Active Directory/LDAP, manage directory connections, and map LDAP attributes to Eloquent models. Includes config, migrations, middleware, and easy-to-use auth/user providers.
config/ldap.php) for hybrid or multi-tenant environments, aligning with enterprise IAM needs.RulePassed, RuleFailed) for workflow integrations (e.g., audit logs, notifications).Auth::guard('ldap')).where('mail', 'like', '%@domain.com')).ldap:import, ldap:browse) for admin tasks.config/ldap.php); no core Laravel files modified.HasLdapPassword, LdapModel).directorytree/ldaprecord (v4.x) with strict version constraints (e.g., ^4.0 in composer.json).| Risk Area | Assessment | Mitigation |
|---|---|---|
| LDAP Schema Variability | Custom attribute mappings and invokable handlers (added in v3.0.5) address non-standard schemas. | Validate schema compatibility early; use ldap:diagnose command. |
| Performance Under Load | Connection pooling (pool.enabled) and batch processing (e.g., LdapImporter) mitigate latency. |
Benchmark with production-like LDAP query volumes; monitor getElapsedTime() metrics. |
| Password Handling | HasLdapPassword trait ensures secure hashing/rehashing (fixed in v3.3.2). |
Enforce password policies via password_column config; audit rehashPasswordIfRequired. |
| Directory Emulator | Local emulator not production-grade; may misrepresent edge cases (e.g., memberof in v3.0.8). |
Use emulator for unit tests; validate critical paths on staging LDAP. |
| Laravel Version Lock | Actively supports Laravel 11–13 (v3.4.3+); no breaking changes. | Pin Laravel version in composer.json (e.g., ^12.0). |
| Multi-Threading | LDAP operations are not thread-safe; single-threaded execution required. | Avoid parallel LDAP queries; use queues for async tasks (e.g., ldap:import). |
| Logging Consistency | Fixed in v4.0.1: Logging now adheres to configured channel (PR #704). | Test logging with custom channels (e.g., stack, single). |
| Migration Complexity | Upgrade from v3.x to v4.x requires config/ldap.php updates (see upgrade guide). | Plan migration in a non-production environment; use ldap:diagnose to validate. |
userPassword) that require encryption during sync?config/ldap.php?mockery)?php-ldap extension (enabled by default in most Laravel deployments).ldap:import, ldap:browse).| Phase | Actions | Tools/Commands |
|---|---|---|
| Pre-Integration | 1. Validate LDAP schema compatibility. | ldap:diagnose |
2. Configure config/ldap.php for connections. |
Manual config | |
3. Extend Eloquent models with LdapModel trait. |
php artisan make:model User --ldap (custom script) |
|
| Authentication | 1. Replace default guard with LdapGuard. |
config/auth.php |
2. Implement custom auth logic (e.g., LdapUserProvider). |
app/Providers/AuthServiceProvider.php |
|
| Data Sync | 1. Set up LdapImporter for bulk operations. |
ldap:import |
| 2. Configure sync schedules (e.g., Laravel tasks). | php artisan schedule:run |
|
| Testing | 1. Use Directory Emulator for unit tests. | php artisan ldap:emulator:start |
| 2. Validate edge cases on staging LDAP. | Manual testing | |
| Production Cutover | 1. Enable LDAP guard in config/auth.php. |
Manual config |
2. Monitor performance with getElapsedTime() metrics. |
Laravel logs |
directorytree/ldaprecord (v4.x for v4.x package).php-ldap extension must be enabled.ldap:diagnose to identify compatibility gaps.How can I help you explore Laravel packages today?