{"id":15963803,"url":"https://github.com/rob006-software/yii2-simple-auth-yii-authenticator","last_synced_at":"2026-05-14T23:38:28.221Z","repository":{"id":62536419,"uuid":"66217887","full_name":"rob006-software/yii2-simple-auth-yii-authenticator","owner":"rob006-software","description":"Simple request authenticator for yii2-httpclient","archived":false,"fork":false,"pushed_at":"2017-10-07T21:52:49.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-11T20:23:09.790Z","etag":null,"topics":["authentication","yii2","yii2-extension","yii2-httpclient"],"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/rob006-software.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-08-21T19:54:57.000Z","updated_at":"2019-02-12T18:42:06.000Z","dependencies_parsed_at":"2022-11-02T15:16:04.440Z","dependency_job_id":null,"html_url":"https://github.com/rob006-software/yii2-simple-auth-yii-authenticator","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/rob006-software/yii2-simple-auth-yii-authenticator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob006-software%2Fyii2-simple-auth-yii-authenticator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob006-software%2Fyii2-simple-auth-yii-authenticator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob006-software%2Fyii2-simple-auth-yii-authenticator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob006-software%2Fyii2-simple-auth-yii-authenticator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rob006-software","download_url":"https://codeload.github.com/rob006-software/yii2-simple-auth-yii-authenticator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob006-software%2Fyii2-simple-auth-yii-authenticator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268883500,"owners_count":24323148,"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-08-05T02:00:12.334Z","response_time":2576,"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":["authentication","yii2","yii2-extension","yii2-httpclient"],"created_at":"2024-10-07T17:00:30.865Z","updated_at":"2026-05-14T23:38:23.149Z","avatar_url":"https://github.com/rob006-software.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Helper for authenticate Request from yii2-httpclient package\n============================================================\n\nYii 2 extension that provides helper for authenticate `Request` from\n[yii2-httpclient](https://github.com/yiisoft/yii2-httpclient) package.\n\nThis is a simple helper for [yii2-simple-auth](https://github.com/rob006/yii2-simple-auth) which\nsimplify authenticating `Request` object from official Yii 2 httpclient extension.\nRead [yii2-simple-auth README](https://github.com/rob006/yii2-simple-auth/blob/master/README.md#configuration)\nto get more details about authentication process and configuration.\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```shell\nphp composer.phar require rob006/yii2-simple-auth-yii-authenticator\n```\n\nor add\n\n```json\n\"rob006/yii2-simple-auth-yii-authenticator\": \"^1.0\"\n```\n\nto the require section of your `composer.json` file.\n\n\nUsage\n-----\n\n\nYou can simply authenticate `Request` object from official Yii 2 [httpclient](https://github.com/yiisoft/yii2-httpclient)\nby using `YiiAuthenticator` helper:\n\n```php\nuse yii\\httpclient\\Client;\nuse rob006\\simpleauth\\YiiAuthenticator as Authenticator;\n\n$client = new Client();\n$request = $client-\u003ecreateRequest()\n\t-\u003esetUrl('http://api.example.com/user/list/')\n\t-\u003esetData(['ids' =\u003e '1,2,3,4']);\n$request = Authenticator::authenticate($request);\n$response = $request-\u003esend();\n```\n\nBy default `Authenticator` sends authentication token in the header of the request. Alternatively\nyou can send it in GET or POST param of request. Be careful when you using POST method because\nthis will set request method as POST and all data set by `\\yii\\httpclient\\Request::setData()` will\nbe sent as POST data and will not be included in the URL.\n\nAuthentication by GET param with custom secret key:\n\n```php\nuse yii\\httpclient\\Client;\nuse rob006\\simpleauth\\YiiAuthenticator as Authenticator;\n\n$client = new Client();\n$request = $client-\u003ecreateRequest()\n\t-\u003esetUrl('http://api.example.com/user/list/')\n\t-\u003esetData(['ids' =\u003e '1,2,3,4']);\n$request = Authenticator::authenticate($request, Authenticator::METHOD_GET, 'mycustomsecretkey');\n$response = $request-\u003esend();\n```\n\nAuthentication by POST param:\n\n```php\nuse yii\\httpclient\\Client;\nuse rob006\\simpleauth\\YiiAuthenticator as Authenticator;\n\n$client = new Client();\n$request = $client-\u003ecreateRequest()\n\t-\u003esetUrl('http://api.example.com/user/list/?ids=1,2,3,4');\n$request = Authenticator::authenticate($request, Authenticator::METHOD_POST);\n$response = $request-\u003esend();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frob006-software%2Fyii2-simple-auth-yii-authenticator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frob006-software%2Fyii2-simple-auth-yii-authenticator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frob006-software%2Fyii2-simple-auth-yii-authenticator/lists"}