{"id":15307161,"url":"https://github.com/michalsn/codeigniter-auth0","last_synced_at":"2025-04-14T23:13:44.384Z","repository":{"id":197555705,"uuid":"671464690","full_name":"michalsn/codeigniter-auth0","owner":"michalsn","description":"Basic integration for Auth0 authentication","archived":false,"fork":false,"pushed_at":"2024-02-06T00:00:36.000Z","size":51,"stargazers_count":3,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-04-14T23:13:34.008Z","etag":null,"topics":["auth0","authentication","codeigniter","codeigniter4","php","php8","sso-authentication"],"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/michalsn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-27T11:30:29.000Z","updated_at":"2024-09-17T15:15:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"c1eb63bc-8b78-4313-8580-83642df3f310","html_url":"https://github.com/michalsn/codeigniter-auth0","commit_stats":null,"previous_names":["michalsn/codeigniter-auth0"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalsn%2Fcodeigniter-auth0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalsn%2Fcodeigniter-auth0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalsn%2Fcodeigniter-auth0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalsn%2Fcodeigniter-auth0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michalsn","download_url":"https://codeload.github.com/michalsn/codeigniter-auth0/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975327,"owners_count":21192210,"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":["auth0","authentication","codeigniter","codeigniter4","php","php8","sso-authentication"],"created_at":"2024-10-01T08:09:19.894Z","updated_at":"2025-04-14T23:13:44.358Z","avatar_url":"https://github.com/michalsn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CodeIgniter Auth0\n\nBasic integration for [Auth0](https://auth0.com/) authentication.\n\n[![PHPStan](https://github.com/michalsn/codeigniter-auth0/actions/workflows/phpstan.yml/badge.svg)](https://github.com/michalsn/codeigniter-auth0/actions/workflows/phpstan.yml)\n[![PHPCPD](https://github.com/michalsn/codeigniter-auth0/actions/workflows/phpcpd.yml/badge.svg)](https://github.com/michalsn/codeigniter-auth0/actions/workflows/phpcpd.yml)\n[![Psalm](https://github.com/michalsn/codeigniter-auth0/actions/workflows/psalm.yml/badge.svg)](https://github.com/michalsn/codeigniter-auth0/actions/workflows/psalm.yml)\n[![Rector](https://github.com/michalsn/codeigniter-auth0/actions/workflows/rector.yml/badge.svg)](https://github.com/michalsn/codeigniter-auth0/actions/workflows/rector.yml)\n[![Deptrac](https://github.com/michalsn/codeigniter-auth0/actions/workflows/deptrac.yml/badge.svg)](https://github.com/michalsn/codeigniter-auth0/actions/workflows/deptrac.yml)\n\n![PHP](https://img.shields.io/badge/PHP-%5E8.0-blue)\n![CodeIgniter](https://img.shields.io/badge/CodeIgniter-%5E4.3-blue)\n\n### Installation\n\n#### Composer\n\n    composer require michalsn/codeigniter-auth0\n\n    composer require guzzlehttp/guzzle guzzlehttp/psr7 http-interop/http-factory-guzzle\n\n#### Manually\n\nIn the example below we will assume, that files from this project will be located in `app/ThirdParty/auth0` directory.\n\nDownload this project and then enable it by editing the `app/Config/Autoload.php` file and adding the `Michalsn\\CodeIgniterAuth0` namespace to the `$psr4` array, like in the below example:\n\n```php\n\u003c?php\n\nnamespace Config;\n\nuse CodeIgniter\\Config\\AutoloadConfig;\n\nclass Autoload extends AutoloadConfig\n{\n    // ...\n    public $psr4 = [\n        APP_NAMESPACE =\u003e APPPATH, // For custom app namespace\n        'Config'      =\u003e APPPATH . 'Config',\n        'Michalsn\\CodeIgniterAuth0' =\u003e APPPATH . 'ThirdParty/auth0/src',\n    ];\n\n    // ...\n```\nAlso add the required helper to the same file under `$files` array:\n\n```php\n    // ...\n    public $files = [\n        APPPATH . 'ThirdParty/auth0/src/Common.php',\n    ];\n\n    // ...\n```\n\nYou will still need to install some dependencies:\n\n    composer require guzzlehttp/guzzle guzzlehttp/psr7 http-interop/http-factory-guzzle\n\n### Database\n\n    php spark migrate --all\n\n### Config\n\nSee what configuration variables can be set by looking at the `src/Config/Auth0.php` file and use the `.env` file to set them.\n\nSee the [getting started](https://auth0.com/docs/libraries/auth0-php) article for reference.\n\n### Routes\n\n- `login`\n- `logout`\n- `callback`\n\n### Filters\n\n- `auth0Stateful`\n\n### Commands\n\nTo copy config file to the application namespace.\n\n    php spark auth0:publish\n\n### Helper functions\n\n- `authenticated()` will check if current user is authenticated\n- `user_id()` will return current user ID (database)\n- `user()` will return current user info (database)\n- `auth0_user()` will return the Auth0 user array or `null`\n\n### Example\n\n```php\n\u003c?php\n\nnamespace App\\Controllers;\n\nclass Home extends BaseController\n{\n    public function index()\n    {\n        if (! service('auth0')-\u003eisAuthenticated()) {\n            return $this-\u003eresponse-\u003esetHeader(401)-\u003esetBody('401 Unauthorized');\n        }\n\n        return view('home/index', $data);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichalsn%2Fcodeigniter-auth0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichalsn%2Fcodeigniter-auth0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichalsn%2Fcodeigniter-auth0/lists"}