Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ldaprecord Laravel Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • LDAP-Centric Design: The package is a tightly integrated Laravel extension for LDAP/Active Directory, leveraging Laravel’s authentication, Eloquent ORM, and event systems. It maintains compatibility with Laravel’s core patterns (e.g., guards, providers, middleware) while abstracting LDAP complexity.
  • Multi-Domain LDAP: Supports multiple LDAP connections (e.g., config/ldap.php) for hybrid or multi-tenant environments, aligning with enterprise IAM needs.
  • Hybrid Auth Flexibility: Enables coexistence with database auth (e.g., fallback to local users) via custom guards/providers, reducing migration risk.
  • Directory Emulator: Provides a local LDAP emulator for development/testing, eliminating production dependency during CI/CD. Note: Not a replacement for staging/production LDAP.
  • Event-Driven Extensibility: Supports custom events (e.g., RulePassed, RuleFailed) for workflow integrations (e.g., audit logs, notifications).

Integration Feasibility

  • Laravel Ecosystem Alignment:
    • Authentication: Drop-in replacement for Laravel’s default auth (e.g., Auth::guard('ldap')).
    • Eloquent Integration: Extends Eloquent models with LDAP query methods (e.g., where('mail', 'like', '%@domain.com')).
    • Artisan Commands: CLI tools (ldap:import, ldap:browse) for admin tasks.
  • Configuration Override: Minimal setup required (e.g., config/ldap.php); no core Laravel files modified.
  • Backward Compatibility: v4.x maintains API stability for v3.x features (e.g., HasLdapPassword, LdapModel).
  • Dependency Management: Hard dependency on directorytree/ldaprecord (v4.x) with strict version constraints (e.g., ^4.0 in composer.json).

Technical Risk

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.

Key Questions for TPM

  1. LDAP Infrastructure:
    • Are there multiple LDAP domains (e.g., AD forests) requiring connection pooling or failover?
    • What is the expected query volume (e.g., user lookups per minute) during peak load?
  2. Authentication Flow:
    • Should LDAP be the primary auth source, or a supplemental fallback (e.g., hybrid with database)?
    • Are there custom password policies (e.g., expiry, complexity) beyond LDAP defaults?
  3. Data Synchronization:
    • Is bidirectional sync required (e.g., database → LDAP updates)? If so, what’s the conflict resolution strategy?
    • Are there sensitive attributes (e.g., userPassword) that require encryption during sync?
  4. Compliance & Security:
    • Are there mandates for TLS/SSL (e.g., LDAPS)? If so, how is this configured in config/ldap.php?
    • Are audit logs required for LDAP operations (e.g., failed logins, attribute changes)?
  5. Testing Strategy:
    • Should the Directory Emulator be used for all tests, or supplemented with a mock LDAP server (e.g., mockery)?
    • Are there performance tests needed for LDAP queries under load?
  6. Deployment & Maintenance:
    • Who will manage LDAP schema changes (e.g., new attributes, group structures)?
    • What’s the rollback plan if LDAP becomes unavailable (e.g., failover to database auth)?
  7. Future-Proofing:
    • Are there plans to extend beyond LDAP (e.g., SAML/OIDC)? If so, how will this package integrate?
    • Should multi-factor authentication (MFA) be layered on top of LDAP auth?

Integration Approach

Stack Fit

  • Laravel Core: Native integration with authentication guards, Eloquent models, and event system.
  • PHP Extensions: Requires php-ldap extension (enabled by default in most Laravel deployments).
  • LDAP Server: Compatible with Active Directory, OpenLDAP, and other LDAPv3-compliant directories.
  • Database: Supports MySQL, PostgreSQL, SQL Server, and other Eloquent-supported databases for hybrid auth.
  • Artisan: CLI tools for admin tasks (e.g., ldap:import, ldap:browse).

Migration Path

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

Compatibility

  • Laravel Versions: Officially supports 11–13 (v3.4.3+); test for 10 if needed (v2.7.2+).
  • LDAPRecord: Hard dependency on directorytree/ldaprecord (v4.x for v4.x package).
  • PHP Versions: Requires PHP 8.1+ (Laravel 11+).
  • Database: No direct DB dependencies beyond Eloquent; works with any supported DB.
  • Extensions: php-ldap extension must be enabled.

Sequencing

  1. Schema Validation:
  2. Configuration:
    • Define LDAP connections in `
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai