{"id":24669098,"url":"https://github.com/solution10/auth","last_synced_at":"2025-10-08T05:32:02.730Z","repository":{"id":18778128,"uuid":"21991315","full_name":"solution10/auth","owner":"solution10","description":"Powerful and extremely flexible authentication for any PHP framework or application.","archived":false,"fork":false,"pushed_at":"2017-03-30T21:01:06.000Z","size":183,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-22T15:03:43.281Z","etag":null,"topics":["access-control","authentication","composer-packages","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/solution10.png","metadata":{"files":{"readme":"readme.md","changelog":null,"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":"2014-07-18T19:07:22.000Z","updated_at":"2020-02-03T18:12:59.000Z","dependencies_parsed_at":"2022-08-30T06:11:14.693Z","dependency_job_id":null,"html_url":"https://github.com/solution10/auth","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/solution10/auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solution10","download_url":"https://codeload.github.com/solution10/auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solution10%2Fauth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278892192,"owners_count":26063946,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["access-control","authentication","composer-packages","php"],"created_at":"2025-01-26T09:19:31.198Z","updated_at":"2025-10-08T05:32:02.325Z","avatar_url":"https://github.com/solution10.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solution10\\Auth\n\nPowerful and extremely flexible authentication\n\n[![Build Status](https://travis-ci.org/Solution10/auth.svg?branch=master)](https://travis-ci.org/Solution10/auth)\n[![Coverage Status](https://coveralls.io/repos/Solution10/auth/badge.png)](https://coveralls.io/r/Solution10/auth)\n[![Latest Stable Version](https://poser.pugx.org/Solution10/auth/v/stable.svg)](https://packagist.org/packages/Solution10/auth)\n[![Total Downloads](https://poser.pugx.org/Solution10/auth/downloads.svg)](https://packagist.org/packages/Solution10/auth)\n[![License](https://poser.pugx.org/Solution10/auth/license.svg)](https://packagist.org/packages/Solution10/auth)\n\n## Key Features\n\n- **Framework agnostic**: \u003cp\u003eCan work with any framework and any ORM / database layer. Implement two classes to integrate with your tools of choice and Auth will do the rest.\u003cbr\u003e[Learn more about Integration](http://github.com/solution10/auth/wiki/Integrating)\u003c/p\u003e\n- **Multiple Instances**: \u003cp\u003eNo statics or manky global scope. Every auth instance is totally self contained and can talk to entirely different backends and session handlers.\u003cbr\u003e[Learn more about Multiple Instances](http://github.com/solution10/auth/wiki/Instances)\u003c/p\u003e\n- **Powerful Permissions**: \u003cp\u003ePackage based permissions allow you to define broad access control groups, and Overrides allow you to allow/disallow permissions on a per-user basis\u003cbr\u003e[Learn more about Permissions](http://github.com/solution10/auth/wiki/Permissions)\u003c/p\u003e\n\n## Installation\n\nInstallation is as you'd expect, simply via a Composer requirement:\n\n```json\n{\n    \"require\": {\n        \"solution10/auth\": \"^1.2\"\n    }\n}\n```\n\n**Note**: Auth provides absolutely no storage capability (no database layer / access). You will need to provide this by implementing a\nStorageDelegate. This approach might seem awkward at first, but it allows you to take completely control over the logic of data-retrieval,\nwhilst Auth handles the actual mechanics for you. [Learn more about Integration](http://github.com/solution10/auth/wiki/Integrating)\n\n## Basic Usage\n\nYour first step should be to complete everything in the [Integration guide](http://github.com/solution10/auth/wiki/Integrating), but that doesn't make for\na sexy demo, so we'll assume you've done that!\n\nLet's pretend that I have fully implemented a StorageDelegate called \"PDOStorageDelegate\".\n\n```php\n// The storage delegate handles reading/writing User data from\n// your data store. That could be a database, REST service, whatever.\n$storageDelegate = new PDOStorageDelegate();\n\n// The session delegate handles maintaining state between\n// page loads. Essentially, it's a front to the $_SESSION array,\n// but if you do it different, you can re-implement!\n$sessionDelegate = new Solution10\\Auth\\Driver\\Session();\n\n// Fire up a new instance called \"MyAuth\"\n$auth = new Solution10\\Auth\\Auth('MyAuth', $sessionDelegate, $storageDelegate);\n\n// Play with some API methods:\nif ($auth-\u003eloggedIn()) {\n    echo 'Hi, '.$auth-\u003euser()-\u003eusername.', welcome to the site!';\n}\n```\n\nAs you may have noticed, we give auth instances names. This gives us a way of referencing them later. More on\nthat in the [Instances](http://github.com/solution10/auth/wiki/Instances) chapter.\n\n### Logging In\n\n```php\nif ($auth-\u003elogin($username, $password)) {\n    echo 'User was logged in!';\n} else {\n    echo 'Please check your username and password.';\n}\n```\n\n### Logging Out\n\n```php\n$auth-\u003elogout();\n```\n\n### Checking Login State\n\n```php\nif ($auth-\u003eloggedIn())) {\n    echo \"You're logged in!\";\n} else {\n    echo \"You are not logged in :(\";\n}\n```\n\n### Getting the Current User\n\n```php\n$user = $auth-\u003euser();\n```\n\n### Forcing a Login\n\nThis should be used with extreme caution, it will allow you to log a user in without their password. Probably only useful after registration.\n\n```php\n// The $user object needs to be a class that implements the\n// Solution10\\Auth\\UserRepresentation interface.\n// It's a tiny interface, but it just gives us enough info to\n// do our work.\n\n$user = new UserRepresentationInstance();\n\n$user-\u003eforceLogin($user);\n```\n\nYou can read more about UserRepresentation in the [Integration guide](http://github.com/solution10/auth/wiki/Integrating)\n\n## PHP Requirements\n\n- PHP \u003e= 5.4\n\n## Documentation\n\nFor a user guide: [Check out the Wiki here on GitHub](http://github.com/solution10/auth/wiki).\n\n## Author\n\nAlex Gisby: [GitHub](http://github.com/alexgisby), [Twitter](http://twitter.com/alexgisby)\n\n## License\n\n[MIT](http://github.com/solution10/auth/tree/master/LICENSE.md)\n\n## Contributing\n\n[Contributors Notes](http://github.com/solution10/auth/tree/master/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolution10%2Fauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolution10%2Fauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolution10%2Fauth/lists"}