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

Integrate LDAP authentication and directory management into Laravel with LdapRecord. Configure connections, sync users and groups, run queries, and handle logins against Active Directory/OpenLDAP with clean, Laravel-friendly APIs and tooling.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • LDAP-Centric Design: The package is a native Laravel extension for LDAP/Active Directory, leveraging Laravel’s authentication stack (guards, providers), Eloquent ORM, and event system. Its architecture aligns well with enterprise authentication workflows (e.g., hybrid auth, multi-domain LDAP) without requiring custom middleware or monolithic refactoring.
  • Multi-Connection Support: Supports multiple LDAP connections via config/ldap.php, critical for multi-tenant SaaS or hybrid AD/LDAP environments. The LdapConnectionManager remains unchanged, ensuring no architectural debt.
  • Hybrid Auth Flexibility: Maintains coexistence with database auth via custom guards/providers (e.g., LdapAuthProvider). This preserves gradual migration paths (e.g., pilot LDAP for enterprise users while keeping consumer users in DB).
  • Directory Emulator: The local LDAP emulator (for testing) is preserved but not production-ready. This is a non-blocker for TPMs prioritizing CI/CD or feature development.
  • Event-Driven Extensibility: Core events (RulePassed, RuleFailed, LoginFailed) remain intact, enabling audit logging, MFA hooks, or custom workflows without modifying the package.
  • Attribute Mapping: Flexible attribute handlers (now supporting closures/invokable classes) reduce boilerplate for non-standard LDAP schemas (e.g., custom AD extensions).

Integration Feasibility

  • Laravel Ecosystem Compatibility:
    • Authentication: Drop-in replacement for Laravel’s default auth (e.g., Auth::guard('ldap')). No changes to app/Providers/AuthServiceProvider.
    • Eloquent Integration: LDAP models extend Eloquent, enabling query builder syntax (e.g., User::where('mail', 'like', '%@company.com')) and relationships (e.g., hasMany for group memberships).
    • Artisan Commands: Built-in commands (ldap:browse, ldap:import) for admin workflows (e.g., bulk user sync).
  • Configuration Override: Minimal setup via config/ldap.php; no core Laravel files are modified. Zero merge conflicts with upstream Laravel updates.
  • Backward Compatibility: v4.x maintains API stability for v3.x features. The upgrade guide is clear, with no breaking changes in v4.0.4 (e.g., password mutator detection).
  • Dependency Management:
    • Hard dependency on directorytree/ldaprecord (v4.x+), which is actively maintained (last release: 2026-06-08).
    • Soft dependencies on php-ldap and ext-ldap (PHP extensions), which are standard for LDAP workflows.
  • Testing Support: Directory Emulator enables 100% local LDAP testing, reducing prod dependency risks during development.

Technical Risk

Risk Area Severity Mitigation TPM Action
LDAP Schema Mismatch High Non-standard LDAP schemas may require custom attribute handlers. Pre-integration: Audit target LDAP schemas; validate with Directory Emulator.
Performance at Scale Medium LDAP queries may lag with >10K users. Benchmark: Test with ldap:browse; optimize with connection pooling (config/ldap.php).
Password Sync Complexity Medium Custom password policies (e.g., expiry) may conflict with AD. Design: Use password_column: false for read-only LDAP; document tradeoffs.
Multi-Tenant Isolation Medium Shared LDAP connection may leak tenant data. Architecture: Scope connections by tenant ID (e.g., config/ldap.connections.tenant_{id}).
Event Overhead Low Excessive logging events (RulePassed) may impact performance. Configure: Set logging.level to debug/info in config/ldap.php.
Upgrade Path Low v4.x introduces minor breaking changes (e.g., rehashPasswordIfRequired). Plan: Test upgrade in staging; use composer why-not to validate compatibility.

Key Questions for TPM

  1. LDAP Environment:
    • Are we integrating with Active Directory, a custom LDAP directory, or both? (Affects schema mapping and connection pooling.)
    • What’s the user count and query volume? (Informs performance tuning.)
  2. Auth Strategy:
    • Will LDAP be primary auth or hybrid (e.g., LDAP for enterprises, DB for consumers)?
    • Are password policies (expiry, complexity) enforced by AD or our app?
  3. Sync Requirements:
    • Do we need real-time sync or batch imports (e.g., nightly)? (Affects LdapImporter config.)
    • How should conflicts be resolved (e.g., merge, ldap_wins)?
  4. Compliance:
    • Are audit logs required for LDAP operations? (Leverage RulePassed/RuleFailed events.)
    • Does the Directory Emulator meet testing needs, or is a mock LDAP server (e.g., 389 Directory Server) required?
  5. Team Skills:
    • Does the team have LDAP admin experience? (Critical for connection troubleshooting.)
    • Is PHP/Laravel expertise sufficient for custom attribute handlers or auth providers?

Integration Approach

Stack Fit

  • Laravel Core: Seamless integration with authentication, Eloquent, and events. No conflicts with Laravel’s default stack.
  • PHP Extensions: Requires php-ldap and ext-ldap (standard for LDAP workflows). Verify via:
    php -m | grep ldap
    
  • Database: Supports MySQL, PostgreSQL, SQL Server, SQLite (via Eloquent). No schema changes required.
  • Artisan: Built-in commands (ldap:browse, ldap:import) for admin workflows.
  • Testing: Directory Emulator replaces prod LDAP for unit/feature tests. Use LDAP_RECORD_EMULATOR=true in .env.

Migration Path

Phase Action Tools/Commands Risk
Prep Audit LDAP schema; validate with Directory Emulator. composer require directorytree/ldaprecord-laravel + emulator tests. Low
Pilot Implement LDAP auth for a single tenant/group. Configure config/ldap.php; extend LdapAuthProvider. Medium (auth flow testing)
Hybrid Auth Merge LDAP and DB auth (e.g., Auth::guard() logic). Custom AuthServiceProvider; test with php artisan auth:guard ldap. Medium (session handling)
Sync Set up bulk imports (ldap:import) or real-time sync (e.g., queue listeners). LdapImporter with --resolve=merge; event listeners for user.created. High (data integrity)
Optimize Tune connection pooling; add caching for frequent queries. config/ldap.php; Laravel cache (e.g., Cache::remember). Low

Compatibility

  • Laravel Versions: Officially supports Laravel 11–13 (v3.4.3+). Tested with PHP 8.1+.
  • LDAP Servers: Compatible with Active Directory, OpenLDAP, 389 Directory Server.
  • Customizations:
    • Attribute Handlers: Extend via closures or invokable classes (v3.0.5+).
    • Auth Providers: Override rehashPasswordIfRequired or validateCredentials.
    • Events: Listen to RulePassed, RuleFailed, or LoginFailed for custom logic.

Sequencing

  1. Core Auth Integration:
    • Configure config/ldap.php for your connection.
    • Extend LdapAuthProvider (if custom logic is needed).
    • Register the guard in AuthServiceProvider:
      Auth::guard('ldap', function ($app) {
          return new LdapAuthProvider($app['auth'], $app['config']['ldap']);
      
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony