{"id":14966678,"url":"https://github.com/damirka/yii2-jwt","last_synced_at":"2025-05-02T22:30:55.099Z","repository":{"id":56961665,"uuid":"45476717","full_name":"damirka/yii2-jwt","owner":"damirka","description":"JWT implementation for Yii2 Authorization process","archived":false,"fork":false,"pushed_at":"2016-08-16T08:31:48.000Z","size":17,"stargazers_count":65,"open_issues_count":0,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-26T03:33:56.535Z","etag":null,"topics":["json-web-token","jwt","php","yii2","yii2-extension","yii2-framework","yii2-jwt","yii2-user"],"latest_commit_sha":null,"homepage":null,"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/damirka.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}},"created_at":"2015-11-03T15:44:09.000Z","updated_at":"2025-03-15T20:58:09.000Z","dependencies_parsed_at":"2022-08-21T10:20:38.723Z","dependency_job_id":null,"html_url":"https://github.com/damirka/yii2-jwt","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damirka%2Fyii2-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damirka%2Fyii2-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damirka%2Fyii2-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damirka%2Fyii2-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damirka","download_url":"https://codeload.github.com/damirka/yii2-jwt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252116026,"owners_count":21697297,"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":["json-web-token","jwt","php","yii2","yii2-extension","yii2-framework","yii2-jwt","yii2-user"],"created_at":"2024-09-24T13:36:47.465Z","updated_at":"2025-05-02T22:30:51.520Z","avatar_url":"https://github.com/damirka.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yii2-jwt\n\nJWT implementation for Yii2 Authorization process\n\nFor details see [JWT official website](https://jwt.io/introduction/).\n\n## Installation\n\nTo install (only master is available now) run:\n```\n    composer require \"damirka/yii2-jwt:v0.2.1\"\n```\nOr add this line to *require* section of composer.json:\n```\n    \"damirka/yii2-jwt\": \"v0.2.1\"\n```\n\n## Usage\n\nThere is only one trait - *UserTrait* - which gives you 5 methods for\nauthorization and JWT-management in User model\n\nSet up:\n\nIn controller:\n\n```PHP\n\u003c?php\n\n// ...\n\nuse yii\\filters\\auth\\HttpBearerAuth;\n\nclass BearerAuthController extends \\yii\\rest\\ActiveController\n{\n    public function behaviors()\n    {\n        return array_merge(parent::behaviors(), [\n            'bearerAuth' =\u003e [\n                'class' =\u003e HttpBearerAuth::className()\n            ]\n        ]);\n    }\n}\n```\n\nIn User model:\n\n```PHP\n\u003c?php\n\n// ...\n\nuse yii\\db\\ActiveRecord;\nuse yii\\web\\IdentityInterface\n\nclass User extends ActiveRecord implements IdentityInterface\n{\n    // Use the trait in your User model\n    use \\damirka\\JWT\\UserTrait;\n\n    // Override this method\n    protected static function getSecretKey()\n    {\n        return 'someSecretKey';\n    }\n\n    // And this one if you wish\n    protected static function getHeaderToken()\n    {\n        return [];\n    }\n\n    // ...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamirka%2Fyii2-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamirka%2Fyii2-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamirka%2Fyii2-jwt/lists"}