{"id":36981543,"url":"https://github.com/hubzero/orcid-php","last_synced_at":"2026-01-13T22:51:23.510Z","repository":{"id":34507964,"uuid":"38449188","full_name":"hubzero/orcid-php","owner":"hubzero","description":"PHP Library for ORCID","archived":false,"fork":false,"pushed_at":"2023-08-11T22:05:51.000Z","size":45,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-09-18T16:02:20.396Z","etag":null,"topics":[],"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/hubzero.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-07-02T18:17:20.000Z","updated_at":"2025-03-27T09:41:37.000Z","dependencies_parsed_at":"2022-09-06T04:11:53.198Z","dependency_job_id":null,"html_url":"https://github.com/hubzero/orcid-php","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/hubzero/orcid-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubzero%2Forcid-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubzero%2Forcid-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubzero%2Forcid-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubzero%2Forcid-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hubzero","download_url":"https://codeload.github.com/hubzero/orcid-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hubzero%2Forcid-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-13T22:51:23.403Z","updated_at":"2026-01-13T22:51:23.499Z","avatar_url":"https://github.com/hubzero.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# orcid-php\nPHP Library for ORCID\n\n[![Build Status](https://travis-ci.org/hubzero/orcid-php.svg?branch=master)](https://travis-ci.org/hubzero/orcid-php)\n[![Coverage Status](https://coveralls.io/repos/hubzero/orcid-php/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/hubzero/orcid-php?branch=master)\n[![StyleCI](https://styleci.io/repos/38449188/shield)](https://styleci.io/repos/38449188)\n\nThis library was started to support the ORCID OAuth2 authentication workflow. It also supports basic profile access, but is a work in progress. More features are to come as needed by the developer or requested/contributed by other interested parties.\n\n## Usage\n\n### OAuth2\n\n#### 3-Legged Oauth Authorization\n\nTo go through the 3-legged oauth process, you must start by redirecting the user to the ORCID authorization page.\n\n```php\n// Set up the config for the ORCID API instance\n$oauth = new Oauth;\n$oauth-\u003esetClientId($clientId)\n      -\u003esetScope('/authenticate')\n      -\u003esetState($state)\n      -\u003eshowLogin()\n      -\u003esetRedirectUri($redirectUri);\n\n// Create and follow the authorization URL\nheader(\"Location: \" . $oauth-\u003egetAuthorizationUrl());\n```\n\nMost of the options described in the ORCID documentation (http://members.orcid.org/api/customize-oauth-login-screen) concerning customizing the user authorization experience are encapsulated in the OAuth class.\n\nOnce the user authorizes your app, they will be redirected back to your redirect URI. From there, you can exchange the authorization code for an access token.\n\n```php\nif (!isset($_GET['code']))\n{\n\t// User didn't authorize our app\n\tthrow new Exception('Authorization failed');\n}\n\n$oauth = new Oauth;\n$oauth-\u003esetClientId($clientId)\n      -\u003esetClientSecret($clientSecret)\n      -\u003esetRedirectUri($redirectUri);\n\n// Authenticate the user\n$oauth-\u003eauthenticate($_GET['code']);\n\n// Check for successful authentication\nif ($oauth-\u003eisAuthenticated())\n{\n\t$orcid = new Profile($oauth);\n\n\t// Get ORCID iD\n\t$id = $orcid-\u003eid();\n}\n```\n\nThis example uses the ORCID public API. A members API is also available, but the OAuth process is essentially the same.\n\n#### Client Credential Authorization\n\nTo be implemented...\n\n### Profile\n\nAs alluded to in the samples above, once successfully authenticated via OAuth, you can make subsequent requests to the other public/member APIs. For example:\n\n```php\n$orcid = new Profile($oauth);\n\n// Get ORCID profile details\n$id    = $orcid-\u003eid();\n$email = $orcid-\u003eemail();\n$name  = $orcid-\u003efullName();\n```\n\nThe profile class currently only supports a limited number of helper methods for directly accessing elements from the profile data. This will be expanded upon as needed. The raw JSON data from the profile output is available by calling the `raw()` method.\n\nNote that some fields (like email) may return null if the user has not made that field available.\n\n### Environment and API types\n\nORCID supports two general API endpoints.  The first is their public API, and a second is for registered ORCID members (membership in this scenario does not simply mean that you have an ORCID account).  The public API is used by default and currently supports all functionality provided by the library.  You can, however, switch to the member API by calling:\n\n```php\n$oauth = new Oauth;\n$oauth-\u003euseMembersApi();\n```\n\nIf you explicitly want to use the public API, you can do so by calling:\n\n```php\n$oauth = new Oauth;\n$oauth-\u003eusePublicApi();\n```\n\nORCID also supports a sandbox environment designed for testing.  To use this environment, rather than the production environment (which is default), you can call the following command:\n\n```php\n$oauth = new Oauth;\n$oauth-\u003euseSandboxEnvironment();\n```\n\nThe counterpart to this function, though not explicitly necessary, is:\n\n```php\n$oauth = new Oauth;\n$oauth-\u003euseProductionEnvironment();\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubzero%2Forcid-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhubzero%2Forcid-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubzero%2Forcid-php/lists"}