- What is adldap2/adldap2-laravel used for in a Laravel application?
- It integrates LDAP directory services into Laravel so you can authenticate users against Active Directory or OpenLDAP instead of a local password table. It also exposes a connection manager, a facade, and Eloquent-style models for querying and managing directory users and groups. Typical uses are corporate single sign-on, attribute sync into a local users table, and admin tooling that reads or writes directory records.
- How do I install and configure adldap2/adldap2-laravel?
- Install it with Composer, publish the config file so config/ldap.php exists, then set your host, base DN, username and password via environment variables. Register the service provider and facade if you are not on package auto-discovery, and add the LDAP guard and provider to config/auth.php. You also need the ext-ldap PHP extension and network reachability to your directory over LDAPS 636 or StartTLS.
- Does Adldap2-Laravel support Laravel 11 or PHP 8.3?
- No. The package was archived upstream with its last tagged release in February 2023, and its illuminate/* constraints target the Laravel 6 through 10 era on PHP 7.3 to 8.x. Installing it on a newer Laravel major will typically fail Composer resolution or require a fork. For current Laravel versions you should use the maintained successor, ldaprecord-laravel.
- What is the difference between Adldap2-Laravel and LdapRecord?
- LdapRecord is the author's successor project and is actively maintained, while Adldap2-Laravel is archived and receives no fixes or security patches. The APIs are substantially similar, and there is a documented migration path, so porting is mostly renaming and small configuration changes. The main practical difference for a new build is lifecycle support rather than features.
- Is it safe to keep using this package in production for LDAP authentication?
- It can keep working, but you are accepting an unpatched tier-zero authentication dependency: any future CVE in LDAP bind handling, TLS verification or auth bypass stays unfixed unless you patch it yourself. Because the repository is archived, issues and pull requests are closed, so bugs you hit become your responsibility. Teams with strict security requirements should either migrate to LdapRecord or maintain a named internal fork with an owner and a review cadence.
- How does the LDAP authentication guard work with Eloquent user models?
- The package ships an authentication driver you register in config/auth.php, plus a trait you add to your User model that imports LDAP attributes into local columns on login or sync. That lets you mix directory authentication with local relationships, roles and permissions stored in your database. You can also run the guard alongside standard database auth if you need a hybrid setup for service accounts or break-glass logins.
- Can Adldap2-Laravel create, modify and delete users in Active Directory?
- Yes, the underlying library supports create, modify and delete operations, password changes, and group membership management. However, write-back is the least-tested surface of an unmaintained package and is exactly where regressions and security problems are most dangerous. Validate every write operation against a dedicated test directory before enabling it in production, and check TLS certificate verification and bind timeout behavior in the vendored code.
- How do I test LDAP authentication without hitting a production domain controller?
- Point the connection config at a disposable OpenLDAP container or a dedicated Active Directory test domain, and set the base DN and credentials through environment variables so test and production configs differ only by env. Avoid validating integration against production AD, since bind failures and lockout policies can affect real accounts. Keep an automated test that covers bind, attribute sync and at least one group lookup.
- What are the main alternatives to Adldap2-Laravel?
- LdapRecord for Laravel, the successor from the same author, is the closest drop-in replacement with a near-identical API and active maintenance. Other options include the lower-level php-ldap extension wrappers, or an external identity provider such as Entra ID, Keycloak or Auth0 with socialite or OIDC integration if you can move away from direct directory binds. For new Laravel projects, start with LdapRecord rather than this package.
- What is the migration path away from Adldap2-Laravel?
- LdapRecord ships a documented upgrade guide, and because the APIs are similar, most changes are namespace, facade and configuration updates. The larger effort is replacing direct calls to the Adldap facade with an internal interface so future swaps are cheap, and auditing all call sites that touch the connection manager. Plan the move before your next Laravel major upgrade, since the frozen Composer constraints are the most likely first breakage.