Download the PHP package maicol07/orcid-php-client without Composer
On this page you can find all versions of the php package maicol07/orcid-php-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package orcid-php-client
Orcid PHP Client
PHP client to send and read workflows on orcid
Based on TKouchoanou/orcid-php-client
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
OAuth2
3-Legged Oauth Authorization
To go through the 3-legged oauth process, you must start by redirecting the user to the ORCID authorization page.
Most 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.
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.
This example uses the ORCID public API. A members API is also available, but the OAuth process is essentially the same.
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:
The profile class currently only supports a limited amount 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
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:
If you explicitly want to use the public API, you can do so by calling:
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:
The counterpart to this function, though not explicitly necessary, is:
Work
Work is a class that allows you to create a publication on your orcid account. The data of a document to send to orcid must be added to a Work instance by the setters. Work provides methods to create an XML document in the format accepted by Orcid.
The minimum configuration for sending an Orcid Work is to define the title, the type of document and add at least an external identifier.
If you want to edit a work, put-code is required.
Works
Works is a class that inherits from arrayIterator. It is a list of orcid works to which we can add instances of type Work with the append method
We can iterate with foreach on works:
OClient
An Orcid client makes it possible to communicate with the orcid count whose authentication elements are contained in the Oauth object, which is passed to the Oclient constructor.
The different methods of Oclient are:
Send: allows you to send one or more publications. It takes as parameter an array of instance of the work class, an instance of works to send several publications or an instance of the work class to send a single publication.
Update: This method allows you to modify a Work already sent to Orcid. You can only modify a work already present in an orcid account with a putCode to recover.To modify don't forget to set putCode
Delete: allows you to delete a job. It takes as parameter the putCode of work on orcid
ReadSummary: Allows you to read all the works present Orcid registration of the account holder represented by $oauth
.
Read : Allows you to read one or more records by taking its parameter a putCode of type int or string or an array of putCode. The putCode must be a numeric value, it is returned by orcid
OResponse
It is a response object returned by Oclient methods. It contains the information of the response returned by Orcid. Requests are made with curl
If the request errors, Orcid returns data, which can be retrieved by these methods, which will return null or an empty string if there has been no error.
About reading all the work records in an orcid account with the ReadSummary method Oresponse has a method, which returns the list of Orcid records read. This method returns null if Oresponse is not the response to a call to the ReadSummary method.
This method returns an instance of Records, which is a list of Record instances
Records and Record
It is an instance whose set of properties represents an orcid work from the user's orcid account. It has some properties in common with the Work instance (the class used to create a work to send to Orcid) and specific properties coming from orcid
ExternalId
Represents an external identifier and contains the four properties $ idType, $ idValue, $ idUrl, $ idRelationship
All versions of orcid-php-client with dependencies
ext-curl Version *
ext-json Version *
ext-mbstring Version *
ext-simplexml Version *
ext-dom Version *
guzzlehttp/guzzle Version >=6
illuminate/support Version >=7
prinsfrank/standards Version ^1