{"id":18961705,"url":"https://github.com/pt-dot/ldap-auth","last_synced_at":"2026-05-15T20:06:18.785Z","repository":{"id":57045602,"uuid":"141882151","full_name":"pt-dot/ldap-auth","owner":"pt-dot","description":"Laravel LDAP authentication wrapper","archived":false,"fork":false,"pushed_at":"2018-07-22T09:50:27.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-01T04:52:46.181Z","etag":null,"topics":["authentication","laravel","ldap","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pt-dot.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-22T09:22:30.000Z","updated_at":"2022-07-01T07:22:44.000Z","dependencies_parsed_at":"2022-08-24T03:40:20.279Z","dependency_job_id":null,"html_url":"https://github.com/pt-dot/ldap-auth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pt-dot%2Fldap-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pt-dot%2Fldap-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pt-dot%2Fldap-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pt-dot%2Fldap-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pt-dot","download_url":"https://codeload.github.com/pt-dot/ldap-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239958313,"owners_count":19724926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["authentication","laravel","ldap","php"],"created_at":"2024-11-08T14:14:03.292Z","updated_at":"2026-05-15T20:06:13.736Z","avatar_url":"https://github.com/pt-dot.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel LDAP Authentication\n\nLaravel LDAP Authentication is a package for authenticating user to Active Directory using **Lightweight Directory Access Protocol** and integrated with Laravel authenticatable model out of the box.\n\n## Requirements\n+ Laravel 5.1 - 5.6\n+ Enable `PHP LDAP` Extension\n\n## Installation\n\nInstall package through composer.\n\n```bash\ncomposer require ptdot/ldapauth\n```\n\nNext, if using Laravel under 5.5, include the service provider and Facade within your `config/app.php` file.\n\n```php\n'providers' =\u003e [\n    Ptdot\\LdapAuth\\LdapAuthServiceProvider::class,\n],\n\n'aliases' =\u003e [\n    'LdapAuth' =\u003e Ptdot\\LdapAuth\\LdapAuthFacade::class,\n]\n```\n\nSince Laravel 5.5+ is using Package Discovery, there is no need manually insert service provider and facade inside your `app.php`.\n\n## Configuration\n\nPublish config using command:\n\n```bash\nphp artisan vendor:publish --tag=config\n```\n\nSet keys and values for your LDAP configuration in `.env` file.\n\n```dotenv\nLDAP_HOST=ldap.example.com\nLDAP_PORT=389\n```\n\nSetup your User model or custom authentication model In `config/ldap.php` file and don't forget to adjust your `usernameField` value from your authentication model.\n\n\u003e Make sure you are already has user data in database and create user model for authentication.\n\n```php\n/*\n    |--------------------------------------------------------------------------\n    | Authentication user model\n    |--------------------------------------------------------------------------\n    |\n    | Authentication is used User model for default.\n    | Define this option if authentication model using different model / namespace.\n    |\n    */\n    'user' =\u003e App\\User::class,\n    'usernameField' =\u003e 'username'\n```\n\n## Usage\n\nFor attempting authentication using LDAP:\n\n```php\n$result = LdapAuth::attempt($username, $password);\n```\nAttempt method will return an array that indicate that authentication is success or not.\n\n**Example**\n\n```php\n/**\n* Logging in using LDAP\n*/\npublic funtion login(Request $request)\n{\n    $username = $request-\u003eget('username');\n    $password = $request-\u003eget('password');\n    \n    $login = LdapAuth::attempt($username, $password);\n    if($login['status']) {\n        return \"Login success\";\n    }\n    return \"Login failed. Error: \".$login['message'];\n}\n```\n\n## Contributing\n\nFeel free to report an issue or merge request if you want to help this package become better and useful.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpt-dot%2Fldap-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpt-dot%2Fldap-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpt-dot%2Fldap-auth/lists"}