{"id":37266334,"url":"https://github.com/sroutier/eloquent-ldap","last_synced_at":"2026-01-16T00:33:45.458Z","repository":{"id":36079001,"uuid":"40378966","full_name":"sroutier/eloquent-ldap","owner":"sroutier","description":"A Laravel 5.1 package that first tries to log the user against the internal database if that fails, it tries against the configured LDAP/AD server.","archived":false,"fork":false,"pushed_at":"2018-01-20T20:39:10.000Z","size":61,"stargazers_count":20,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-06T17:22:29.546Z","etag":null,"topics":["active-directory","authentication","eloquent","laravel","laravel-package","ldap","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dave/jennifer","license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sroutier.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-07T20:07:29.000Z","updated_at":"2025-02-06T16:00:37.000Z","dependencies_parsed_at":"2022-08-24T07:40:07.157Z","dependency_job_id":null,"html_url":"https://github.com/sroutier/eloquent-ldap","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/sroutier/eloquent-ldap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroutier%2Feloquent-ldap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroutier%2Feloquent-ldap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroutier%2Feloquent-ldap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroutier%2Feloquent-ldap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sroutier","download_url":"https://codeload.github.com/sroutier/eloquent-ldap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroutier%2Feloquent-ldap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28421240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["active-directory","authentication","eloquent","laravel","laravel-package","ldap","php"],"created_at":"2026-01-16T00:33:44.116Z","updated_at":"2026-01-16T00:33:45.450Z","avatar_url":"https://github.com/sroutier.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eloquent-ldap\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n\nA Laravel package that first tries to log the user against the internal \ndatabase, if that fails, it tries against the configured LDAP/AD \nserver. Optionally it will create a local user record on first\nlogin of an LDAP user, as well as grant that user permissions\nto local groups that have matching names of the LDAP groups\nthat the user is a member of.\n\n\n## Version Compatibility\n\n Laravel  | LERN\n:---------|:----------\n 5.1.x    | 1.x\n 5.5.x    | 2.x\n\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require sroutier/eloquent-ldap\n```\n\n## Declare provider\n\nAdd this declaration in the provider array of your `./config/app.php` file:\n\n``` php\n        Sroutier\\EloquentLDAP\\Providers\\EloquentLDAPServiceProvider::class,\n```\n\n## Publish assets\n\nTo publish the assets, config file and migration scripts, run this command:\n\n``` bash\n$ php artisan vendor:publish --provider=\"Sroutier\\EloquentLDAP\\Providers\\EloquentLDAPServiceProvider\"\n```\n\nThis will publish a config file and a migration file.\n\n## Migration\n\nThe migration script will add a new column `auth_type` to the schema of the \n`users` table, and one column `resync_on_login` to the `groups` table. You \nshould already have both tables, but if you do not or if you want to use\ndifferent tables for those purposes, the migration to create those \ntables is provided as an example, but commented out. You will \nwant to review the migration script and adjust according to \nyour scenario.\n\nOnce ready, run the migration script with this command:\n\n``` bash\n$ php artisan migrate\n```\n\n## Configure\n\nThe recommended way to configure this package is by defining the following \nvariables in you `.env` file and adjusting the values there. For a \ndetailed explanation of each setting, refer to the config file \nthat you published above.\n\nThe configuration that you will need will vary based on the type or server that you wish to authenticate against.\nBelow are example config section for both options, Lightweight Directory Access Protocol (LDAP) and Microsoft \nActive Directory (MSAD).\n\n### Microsoft Active Directory server.\n\nBelow is a section of a ```.env``` config file that shows how to configure your system to access a Microsoft Active \nDirectory server:\n\n```\neloquent-ldap.enabled=true\neloquent-ldap.debug=false\neloquent-ldap.server_type=MSAD\neloquent-ldap.create_accounts=true\neloquent-ldap.replicate_group_membership=true\neloquent-ldap.resync_on_login=true\neloquent-ldap.group_model=App\\Models\\Role\neloquent-ldap.label_internal=internal\neloquent-ldap.label_ldap=ldap\neloquent-ldap.account_suffix=@company.com\neloquent-ldap.base_dn=DC=department,DC=company,DC=com\neloquent-ldap.server=ldapsrv01.company.com\neloquent-ldap.port=389\neloquent-ldap.user_name=ldap_reader\neloquent-ldap.password=PaSsWoRd\neloquent-ldap.return_real_primary_group=true\neloquent-ldap.secured=false\neloquent-ldap.secured_port=636\neloquent-ldap.recursive_groups=true\neloquent-ldap.sso=false\neloquent-ldap.username_field=samaccountname\neloquent-ldap.email_field=userprincipalname\neloquent-ldap.first_name_field=givenname\neloquent-ldap.last_name_field=sn\neloquent-ldap.user_filter=(\u0026(objectcategory=person)(samaccountname=%username))\n```\n\n### Lightweight Directory Access Protocol server.\n\nBelow is a section of a ```.env``` config file that shows how to configure your system to access a Lightweight \nDirectory Access Protocol server:\n\n```\neloquent-ldap.enabled=true\neloquent-ldap.debug=false\neloquent-ldap.server_type=LDAP\neloquent-ldap.create_accounts=true\neloquent-ldap.replicate_group_membership=false\neloquent-ldap.resync_on_login=false\neloquent-ldap.group_model=App\\Models\\Role\neloquent-ldap.label_internal=internal\neloquent-ldap.label_ldap=ldap\neloquent-ldap.account_suffix=\neloquent-ldap.base_dn=dc=example,dc=com\neloquent-ldap.server=ldap.forumsys.com\neloquent-ldap.port=389\neloquent-ldap.user_name=cn=read-only-admin,dc=example,dc=com\neloquent-ldap.password=password\neloquent-ldap.return_real_primary_group=true\neloquent-ldap.secured=false\neloquent-ldap.secured_port=636\neloquent-ldap.recursive_groups=true\neloquent-ldap.sso=false\neloquent-ldap.username_field=uid\neloquent-ldap.email_field=mail\neloquent-ldap.first_name_field=\neloquent-ldap.last_name_field=sn\neloquent-ldap.user_filter=(\u0026(objectclass=person)(uid=%username))\n```\n\n**_NOTE:_** THe configuration options above will allow you to connect and authenticate users using the publicly \navailable OpenLDAP test server hosted by \n[Forum Systems](http://www.forumsys.com/en/tutorials/integration-how-to/ldap/online-ldap-test-server/).\n\n### MSAD vs LDAP\n\nA couple of difference in how to configure the system depending on which server type is being used are worth pointing \nout.\n\n* eloquent-ldap.server_type: Can be either LDAP or MSAD. Lets the system know how to interact with the authentication server.\n* eloquent-ldap.replicate_group_membership: Currently only supported for MSAD servers.\n* eloquent-ldap.resync_on_login: Currently only supported for MSAD servers.\n* eloquent-ldap.account_suffix:\n    * LDAP: Should remain empty for LDAP servers. \n    * MSAD: Should contain the static part of the users email address.\n* eloquent-ldap.user_name:\n    * LDAP: Should be the complete DN of the user to bind with.\n    * MSAD: Simply the name of the user to bind with.\n* eloquent-ldap.return_real_primary_group:\n    * LDAP: Not used.\n    * MSAD: Fix Microsoft AD not following standards may incur extra processing.\n\n## Usage\n\nThe `users` table/model must have the following columns/attributes named \n`username`, `first_name`, `last_name` and `email`. The migration \nscript provided with this package has an example of how to \ncreate such a table but it is commented out.\n \nThe user model must have the `auth-type` attribute added to its `fillable` array\nto allow setting the column in the database.\n\nAlso your login view and `AuthController` must accept a user name and password.\nThey can accept other fields if you want, such as email, security token, \netc... But the first time a new user tries to log in, since he will not\nbe found in the local database, the package will need the user name to\nauthenticate against the LDAP server. \n\n## Example\n\nFor a concrete example of this package used in an active project, see \n[sroutier/laravel-5.1-enterprise-starter-kit](https://github.com/sroutier/laravel-5.1-enterprise-starter-kit).\nNote that in that project this package is used in combination with \n[Zizaco/entrust](https://github.com/zizaco/entrust) to provide\nrole based authorization, therefore there is no group model, \nbut instead a role model.\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email sroutier@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Sebastien Routier](https://github.com/sroutier)\n- [All Contributors](https://github.com/sroutier/eloquent-ldap/graphs/contributors)\n\n## License\n\nThe GNU General Public License Version 3 (GPLv3). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/badge/packagist-v0.1.2-orange.svg\n[ico-license]: https://img.shields.io/badge/licence-GPLv3-brightgreen.svg\n\n[link-packagist]: https://packagist.org/packages/sroutier/eloquent-ldap\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsroutier%2Feloquent-ldap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsroutier%2Feloquent-ldap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsroutier%2Feloquent-ldap/lists"}