PHPackages                             renanbr/crossref-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. renanbr/crossref-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

renanbr/crossref-client
=======================

Client for CrossRef REST API

1.1.1(3y ago)736.2k—8%6[2 PRs](https://github.com/renanbr/crossref-client/pulls)MITPHPPHP &gt;=5.6.0

Since Aug 22Pushed 2y ago2 watchersCompare

[ Source](https://github.com/renanbr/crossref-client)[ Packagist](https://packagist.org/packages/renanbr/crossref-client)[ RSS](/packages/renanbr-crossref-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (8)Versions (8)Used By (0)

PHP CrossRef Client
===================

[](#php-crossref-client)

 This is a library for the [Crossref REST API](https://www.crossref.org/services/metadata-delivery/rest-api/) written in [PHP](https://php.net).

 [ ![Crossref Metadata APIs logo](https://camo.githubusercontent.com/fce3e4580b7edcd2d4f85be9dcc7d9d68ed26983ad029240b7f9dda875399d0f/68747470733a2f2f6173736574732e63726f73737265662e6f72672f6c6f676f2f63726f73737265662d6d657461646174612d617069732d3230302e737667) ](https://www.crossref.org/services/metadata-delivery/rest-api/) [ ![PHP logo](https://camo.githubusercontent.com/4483bf574aa290f3a83765b3f21279c4478760d0074d01e3a2a79ac14ff4ac7e/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f322f32372f5048502d6c6f676f2e737667) ](https://php.net)

[![Tests](https://github.com/renanbr/crossref-client/workflows/Tests/badge.svg)](https://github.com/renanbr/crossref-client/workflows/Tests/badge.svg)[![codecov](https://camo.githubusercontent.com/929dc56ef15b73ced159b54c3c4d859c82441a76261c79ab5fed13525ca9655b/68747470733a2f2f636f6465636f762e696f2f67682f72656e616e62722f63726f73737265662d636c69656e742f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/renanbr/crossref-client)[![Static Analysis](https://github.com/renanbr/crossref-client/workflows/Static%20Analysis/badge.svg)](https://github.com/renanbr/crossref-client/workflows/Static%20Analysis/badge.svg)[![Coding Standards](https://github.com/renanbr/crossref-client/workflows/Coding%20Standards/badge.svg)](https://github.com/renanbr/crossref-client/workflows/Coding%20Standards/badge.svg)

Table of contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Installing](#installing)
- [Usage](#usage)
    - [Singletons](#singletons)
    - [Determine existence of a singleton](#determine-existence-of-a-singleton)
    - [Lists](#lists)
- [Configuration](#configuration)
    - [Caching results](#caching-results)
    - [Identifying your script](#identifying-your-script)
    - [Tying to a specific major version](#tying-to-a-specific-major-version)
    - [Rate limits](#rate-limits)
- [Handling errors](#handling-errors)

Introduction
------------

[](#introduction)

This is **NOT** an official library! The intent of this library is to provide an easy way to make requests to the CrossRef's REST API. You **SHOULD** read this documentation in conjunction with the [official documentation](https://github.com/CrossRef/rest-api-doc).

Highlighted features:

- You don't need to worry about making HTTP requests;
- Proper exceptions are thrown if an HTTP error occurs;
- You receive responses as-is, without overlay;
- [Filter](https://github.com/CrossRef/rest-api-doc#filter-names) and [facet](https://github.com/CrossRef/rest-api-doc#facet-counts) parameters are encoded if needed;
- You can [cache responses](https://github.com/CrossRef/rest-api-doc#etiquette) easily;
- You can [identify yourself](https://github.com/CrossRef/rest-api-doc#good-manners--more-reliable-service), then you can benefit better service;
- You can [tie to a specific major version of the API](https://github.com/CrossRef/rest-api-doc#how-to-manage-api-versions);
- Your application complies with the [rate limit](https://github.com/CrossRef/rest-api-doc#rate-limits) (it works better if cache is configured).

Library's summary:

```
class RenanBr\CrossRefClient
{
    // Returns JSON decoded as array
    public function request($path, array $parameters = []);

    // Returns boolean
    public function exists($path);

    public function setUserAgent($userAgent);
    public function setCache(Psr\SimpleCache\CacheInterface $cache);
    public function setVersion($version);
}
```

Installing
----------

[](#installing)

```
composer require renanbr/crossref-client ^1
```

Usage
-----

[](#usage)

### Singletons

[](#singletons)

> Singletons are single results. Retrieving metadata for a specific identifier (e.g. DOI, ISSN, funder\_identifier) typically returns in a singleton result.

See:

```
require __DIR__ . '/vendor/autoload.php';
$client = new RenanBr\CrossRefClient();
$work = $client->request('works/10.1037/0003-066X.59.1.29');
print_r($work);
```

The above example will output:

```
Array
(
    [status] => ok
    [message-type] => work
    [message-version] => 1.0.0
    [message] => Array
        (
            ...

            [DOI] => 10.1037/0003-066x.59.1.29
            [type] => journal-article

            ...

            [title] => Array
                (
                    [0] => How the Mind Hurts and Heals the Body.
                )

            ...
        )
)

```

### Determine existence of a singleton

[](#determine-existence-of-a-singleton)

> (...) \[You can\] determine "existence" of a singleton. The advantage of this technique is that it is very fast because it does not return any metadata (...)

See:

```
require __DIR__ . '/vendor/autoload.php';
$client = new RenanBr\CrossRefClient();
$exists = $client->exists('members/98');
var_dump($exists);
```

The above example will output:

```
bool(true)

```

### Lists

[](#lists)

> Lists results can contain multiple entries. Searching or filtering typically returns a list result.

A list has two parts: Summary; and Items. Normally, an API list result will return both.

See:

```
require __DIR__ . '/vendor/autoload.php';
$client = new RenanBr\CrossRefClient();

$parameters = [
    'query' => 'global state',
    'filter' => [
        'has-orcid' => true,
    ],
];
$result = $client->request('works', $parameters);

foreach ($result['message']['items'] as $work) {
    // ...
}
```

Configuration
-------------

[](#configuration)

### Caching results

[](#caching-results)

> Cache data so you don't request the same data over and over again.

See:

```
require __DIR__ . '/vendor/autoload.php';
$client = new RenanBr\CrossRefClient();
$client->setCache(new voku\cache\CachePsr16());

// ...
```

The above example uses [voku/simple-cache](https://github.com/voku/simple-cache) as cache implementation, but you can use [any PSR-16 implementation](https://packagist.org/providers/psr/simple-cache-implementation) because `setCache()` accept [Psr\\SimpleCache\\CacheInterface](http://www.php-fig.org/psr/psr-16/#21-cacheinterface) as argument.

### Identifying your script

[](#identifying-your-script)

> As of September 18th 2017 any API queries that use HTTPS and have appropriate contact information will be directed to a special pool of API machines that are reserved for polite users.

See:

```
require __DIR__ . '/vendor/autoload.php';
$client = new RenanBr\CrossRefClient();
$client->setUserAgent('GroovyBib/1.1 (https://example.org/GroovyBib/; mailto:GroovyBib@example.org)');

// ...
```

The above example makes all subsequent requests attach the contact information given.

### Tying to a specific major version

[](#tying-to-a-specific-major-version)

> If you need to tie your implementation to a specific major version of the API, you can do so by using version-specific routes. The default route redirects to the most recent version of the API.

See:

```
require __DIR__ . '/vendor/autoload.php';
$client = new RenanBr\CrossRefClient();
$client->setVersion('v55');

// ...
```

The above example tie all subsequent requests to the API version `v55`.

### Rate limits

[](#rate-limits)

By default, this library conforms to the rate limit imposed by the API for the **current execution**.

If you want to keep this behavior **across multiple executions**, you must configure the cache, as mentioned above.

Handling errors
---------------

[](#handling-errors)

As this library uses [guzzlehttp/guzzle](http://guzzlephp.org) internally. Please refer to the [Guzzle Exceptions documentation](http://docs.guzzlephp.org/en/stable/quickstart.html#exceptions) to see how to handle exceptions properly.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 95.1% 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 ~855 days

Total

4

Last Release

1357d ago

Major Versions

0.1 → 1.0.02018-05-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e1aa2e77d3574f9aa318fde02fe0f6113404f44c244529caceed0e1dadf4b66?d=identicon)[renanbr](/maintainers/renanbr)

---

Top Contributors

[![renanbr](https://avatars.githubusercontent.com/u/350222?v=4)](https://github.com/renanbr "renanbr (39 commits)")[![edent](https://avatars.githubusercontent.com/u/837136?v=4)](https://github.com/edent "edent (1 commits)")[![uberengineer](https://avatars.githubusercontent.com/u/66420512?v=4)](https://github.com/uberengineer "uberengineer (1 commits)")

---

Tags

api-clientcrossrefcrossref-apicrossref-clientphpapiclientrestapi clientcrossrefcrossref-apicrossref-client

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/renanbr-crossref-client/health.svg)

```
[![Health](https://phpackages.com/badges/renanbr-crossref-client/health.svg)](https://phpackages.com/packages/renanbr-crossref-client)
```

###  Alternatives

[cybercog/youtrack-rest-php

YouTrack REST API PHP Client.

37149.2k3](/packages/cybercog-youtrack-rest-php)[meteocontrol/vcom-api-client

HTTP Client for meteocontrol's VCOM API - The VCOM API enables you to directly access your data on the meteocontrol platform.

175.7k1](/packages/meteocontrol-vcom-api-client)[jonathanraftery/bullhorn-rest-client

Simple REST client for the Bullhorn API, including automated OAuth2 login

1142.7k](/packages/jonathanraftery-bullhorn-rest-client)[repat/plentymarkets-rest-client

REST Client for Plentymarkets

1510.0k](/packages/repat-plentymarkets-rest-client)

PHPackages © 2026

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