PHPackages                             qeios-lab/orcid-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. qeios-lab/orcid-php

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

qeios-lab/orcid-php
===================

Library for ORCID web services

v0.3.1(7y ago)016.7k↑771%MITPHPPHP &gt;=5.6.0CI failing

Since Sep 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/QeiosLab/orcid-php)[ Packagist](https://packagist.org/packages/qeios-lab/orcid-php)[ RSS](/packages/qeios-lab-orcid-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

orcid-php
=========

[](#orcid-php)

PHP Library for ORCID

[![Build Status](https://camo.githubusercontent.com/569dae370e781cb9b5ee53b0d3ca35374fd4d90eae9c2fa8c6151cc58b12d4d0/68747470733a2f2f7472617669732d63692e6f72672f6875627a65726f2f6f726369642d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hubzero/orcid-php)[![Coverage Status](https://camo.githubusercontent.com/d35976c9c99e564b69052ffea897ca3aa0392c41a072ad79bd9de51b169d026c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6875627a65726f2f6f726369642d7068702f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/hubzero/orcid-php?branch=master)[![StyleCI](https://camo.githubusercontent.com/953f5034c429ed389467abb46de68db19698b08fd718d882b3f8a0b2a143d28b/68747470733a2f2f7374796c6563692e696f2f7265706f732f33383434393138382f736869656c64)](https://styleci.io/repos/38449188)

This 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.

Usage
-----

[](#usage)

### OAuth2

[](#oauth2)

#### 3-Legged Oauth Authorization

[](#3-legged-oauth-authorization)

To go through the 3-legged oauth process, you must start by redirecting the user to the ORCID authorization page.

```
// Set up the config for the ORCID API instance
$oauth = new Oauth;
$oauth->setClientId($clientId)
      ->setScope('/authenticate')
      ->setState($state)
      ->showLogin()
      ->setRedirectUri($redirectUri);

// Create and follow the authorization URL
header("Location: " . $oauth->getAuthorizationUrl());
```

Most of the options described in the ORCID documentation () concerning customizing the user authorization experience are encapsulated in the OAuth class.

Once 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.

```
if (!isset($_GET['code']))
{
	// User didn't authorize our app
	throw new Exception('Authorization failed');
}

$oauth = new Oauth;
$oauth->setClientId($clientId)
      ->setClientSecret($clientSecret)
      ->setRedirectUri($redirectUri);

// Authenticate the user
$oauth->authenticate($_GET['code']);

// Check for successful authentication
if ($oauth->isAuthenticated())
{
	$orcid = new Profile($oauth);

	// Get ORCID iD
	$id = $orcid->id();
}
```

This example uses the ORCID public API. A members API is also available, but the OAuth process is essentially the same.

#### Client Credential Authorization

[](#client-credential-authorization)

To be implemented...

### Profile

[](#profile)

As alluded to in the samples above, once successfully authenticated via OAuth, you can make subsequent requests to the other public/member APIs. For example:

```
$orcid = new Profile($oauth);

// Get ORCID profile details
$id    = $orcid->id();
$email = $orcid->email();
$name  = $orcid->fullName();
```

The 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.

Note that some fields (like email) may return null if the user has not made that field available.

### Environment and API types

[](#environment-and-api-types)

ORCID 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:

```
$oauth = new Oauth;
$oauth->useMembersApi();
```

If you explicitly want to use the public API, you can do so by calling:

```
$oauth = new Oauth;
$oauth->usePublicApi();
```

ORCID 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:

```
$oauth = new Oauth;
$oauth->useSandboxEnvironment();
```

The counterpart to this function, though not explicitly necessary, is:

```
$oauth = new Oauth;
$oauth->useProductionEnvironment();
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~225 days

Recently: every ~280 days

Total

6

Last Release

2756d ago

PHP version history (2 changes)v0.1PHP &gt;=5.4.0

v0.3PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a2a4bfa118ac3d8daa88025a2969e3e67baa9dda6f0b4c70f293a835c7211068?d=identicon)[QeiosLab](/maintainers/QeiosLab)

---

Top Contributors

[![spwilson806](https://avatars.githubusercontent.com/u/5543773?v=4)](https://github.com/spwilson806 "spwilson806 (13 commits)")[![zooley](https://avatars.githubusercontent.com/u/5552864?v=4)](https://github.com/zooley "zooley (9 commits)")[![QeiosLab](https://avatars.githubusercontent.com/u/59286591?v=4)](https://github.com/QeiosLab "QeiosLab (2 commits)")[![illuminatusds](https://avatars.githubusercontent.com/u/4513912?v=4)](https://github.com/illuminatusds "illuminatusds (1 commits)")

---

Tags

phpoauthorcid

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/qeios-lab-orcid-php/health.svg)

```
[![Health](https://phpackages.com/badges/qeios-lab-orcid-php/health.svg)](https://phpackages.com/packages/qeios-lab-orcid-php)
```

###  Alternatives

[artdarek/oauth-4-laravel

OAuth Service Provider for Laravel 4

693504.8k](/packages/artdarek-oauth-4-laravel)[andalisolutions/oauth2-anaf

Anaf OAuth 2.0 support for the PHP League's OAuth 2.0 Client

194.1k](/packages/andalisolutions-oauth2-anaf)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
