{"id":16331638,"url":"https://github.com/soxft/openid-sdk-php","last_synced_at":"2026-01-11T13:19:47.990Z","repository":{"id":49169327,"uuid":"425489939","full_name":"soxft/openID-sdk-php","owner":"soxft","description":"sdk of xopenId","archived":false,"fork":false,"pushed_at":"2024-09-26T02:12:11.000Z","size":62,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-08T03:06:56.864Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://9420.ltd","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soxft.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":"2021-11-07T11:53:31.000Z","updated_at":"2024-09-26T02:11:50.000Z","dependencies_parsed_at":"2022-09-21T11:11:44.630Z","dependency_job_id":null,"html_url":"https://github.com/soxft/openID-sdk-php","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soxft%2FopenID-sdk-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soxft%2FopenID-sdk-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soxft%2FopenID-sdk-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soxft%2FopenID-sdk-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soxft","download_url":"https://codeload.github.com/soxft/openID-sdk-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231345792,"owners_count":18362501,"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":[],"created_at":"2024-10-10T23:27:53.796Z","updated_at":"2026-01-11T13:19:47.946Z","avatar_url":"https://github.com/soxft.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# openIdSdk\n \u003e sdk of x openId\n\n# 使用方法\n\n## 下载sdk\n\n\u003e 目前仅提供php sdk, 支持php 7+,php 8\n\n- 使用Git: [https://github.com/soxft/openIdSdk/](https://github.com/soxft/openIdSdk/)\n- 使用Composer: composer require soxft/openidsdk\n\n## 使用sdk\n\n在`v1 API`中, 您可以在您的网站上添加一个按钮或图标跳转至我们的授权接口获取`token`, 验证用户身份后, 将自动携带token跳转至您的回调地址.\n\n对于使用 composer 引入`sdk`后, 我们可以尝试通过以下方法跳转至授权界面:\n\n```php\n\u003c?php\n    require_once \"/path/to/vendor/autoload.php\";\n    \n    use soxft\\OpenIdSdk; //使用命名空间\n\n    $xopenid = new OpenIdSdk('appid', 'app_secret');\n\n    $xopenid-\u003ejump('redirect_uri'); //该方法将会直接跳转至授权界面, 不用让用户点击\n?\u003e\n```\n- 在上述代码中 `appid` 代表您的应用ID, `app_secret`代表您的应用密钥,`redirect_uri` 代表您的回调地址\n\n接下来, 在您的业务代码中再次调用:\n```php\n\u003c?php\n    require_once \"/path/to/vendor/autoload.php\";\n    \n    use soxft\\OpenIdSdk; //使用命名空间\n\n    $xopenid = new OpenIdSdk('appid', 'app_secret');\n\n    $res = $xopenid-\u003egetUserInfo($_GET['token'] ?? \"\"); // 如果token正确 该方法会返回用户信息\n\n    print_r($res); //输出用户信息\n\n    /** 用户登录逻辑代码 **/\n?\u003e\n```\n- 在上述的代码中 `token` 为您的回调端中 Query 参数中的token, 一般由授权端跳转得到\n\n如果配置正确, 您将会得到用户的 `open_id` 以及 `unique_id`, 之后你可以继续处理您的登录逻辑.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoxft%2Fopenid-sdk-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoxft%2Fopenid-sdk-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoxft%2Fopenid-sdk-php/lists"}