{"id":19210679,"url":"https://github.com/mhndev/oauth-client","last_synced_at":"2026-06-11T20:31:03.198Z","repository":{"id":62527834,"uuid":"88410709","full_name":"mhndev/oauth-client","owner":"mhndev","description":"php oauth client (sdk)","archived":false,"fork":false,"pushed_at":"2018-10-07T15:32:34.000Z","size":95,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-02-23T07:31:51.452Z","etag":null,"topics":["oauth-server","oauth2","oauth2-client","sdk-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/mhndev.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":"2017-04-16T12:07:40.000Z","updated_at":"2023-08-27T18:34:46.000Z","dependencies_parsed_at":"2022-11-02T15:30:57.168Z","dependency_job_id":null,"html_url":"https://github.com/mhndev/oauth-client","commit_stats":null,"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/mhndev/oauth-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhndev%2Foauth-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhndev%2Foauth-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhndev%2Foauth-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhndev%2Foauth-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhndev","download_url":"https://codeload.github.com/mhndev/oauth-client/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhndev%2Foauth-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34217312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"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":["oauth-server","oauth2","oauth2-client","sdk-php"],"created_at":"2024-11-09T13:36:49.931Z","updated_at":"2026-06-11T20:31:03.171Z","avatar_url":"https://github.com/mhndev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## Php OAuth Client (Sdk) \n\ntokens table structure : \n\n```\n    CREATE TABLE tokens (\n        client_id TEXT NOT NULL PRIMARY KEY,\n        client_secret TEXT NOT NULL,\n        credentials TEXT NOT NULL,\n        type TEXT NOT NULL,\n        expires_at datetime\n    );\n\n```\n\n\n```php\n\u003c?php\nini_set('display_errors', 1);\nini_set('display_startup_errors', 1);\nerror_reporting(E_ALL);\n\n\nrequire_once 'vendor/autoload.php';\n\n\n$client_id = 1;\n$client_secret = 'DONjJxACnkVqzHPoHOoUmfEmUjnDnXJiT0PuqCzO';\n\n$tokenRepository = new \\mhndev\\oauthClient\\repository\\TokenRepositorySqlite(\n    (new \\mhndev\\oauthClient\\SqLiteConnection(__DIR__.DIRECTORY_SEPARATOR.'db.sqlite'))-\u003econnect()\n);\n\n$guzzleClient = new \\GuzzleHttp\\Client();\n\n$guzzleHandler = new \\mhndev\\oauthClient\\handlers\\GuzzleHandler(\n    $guzzleClient,\n    'http://dev.digipeyk.com:8030'\n);\n\n// if you want to pass api ednpoints and you are not going to use default endpoints please pass the third argument as follow:\n// consider you can just override as many endpoint as you want, and you are not forced to override all endpoints\n$guzzleHandler = new \\mhndev\\oauthClient\\handlers\\GuzzleHandler(\n    $guzzleClient,\n    'http://dev.digipeyk.com:8030',\n    ['removeIdentifier' =\u003e '/api/removeUserIdentifier']\n);\n\n$oauth_client = new \\mhndev\\oauthClient\\Client($guzzleHandler, $tokenRepository);\n\n$token = $oauth_client-\u003egetClientToken($client_id, $client_secret);\n\n//register endpoint\n$user_register = $oauth_client-\u003eregister(\n    'hamid',\n    '123456',\n    ['email'=\u003e'ma2jid8911303@gmail.com'],\n    $token\n);\n\nvar_dump($user_register);\n\n// whois endpoint\n\n$user_whoIs = $oauth_client-\u003egetWhois(\n    'email',\n    'majid8911303@gmail.com',\n    $token\n);\n\n\nvar_dump($user_whoIs);\n\n// get Token Info\n\n$tokenValueObject = new \\mhndev\\valueObjects\\implementations\\Token(\n    $token-\u003egetCredentials(), $token-\u003egetType()\n);\n\n$tokenInfo = $oauth_client-\u003egetTokenInfo($tokenValueObject);\n\nvar_dump($tokenInfo);\n\n\n\necho '\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e';\n\n// now using mock handler instead as handler\n\n$mockHandler = new \\mhndev\\oauthClient\\handlers\\MockHandler();\n\n$oauth_client2 = new \\mhndev\\oauthClient\\Client($mockHandler, $tokenRepository);\n\n\n$tokenFromMock = $oauth_client2-\u003egetClientToken('wefwergderf', 'werwrgfer');\n\nvar_dump($tokenFromMock);\n\n$result = $oauth_client2-\u003eregister(\n    'majid',\n    '123456',\n    ['email' =\u003e 'majid@gmail.com'],\n    new \\mhndev\\oauthClient\\entity\\common\\Token(\n        'Bearer',\n        '34r3t354t54tr',\n        $client_id,\n        $client_secret\n    )\n);\n\n\nvar_dump($result);\n\n\n```\n\n\n\ntodo :\ntoArray for oauth objects\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhndev%2Foauth-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhndev%2Foauth-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhndev%2Foauth-client/lists"}