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

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

olendorf/ezid-php
=================

A library to simplify interacting with the EZID API for managing DOIs and ARKs.

v0.0.1(10y ago)3605[1 issues](https://github.com/olendorf/ezid-php/issues)MITPHP

Since Mar 31Pushed 9y ago1 watchersCompare

[ Source](https://github.com/olendorf/ezid-php)[ Packagist](https://packagist.org/packages/olendorf/ezid-php)[ Docs](https://github.com/olendorf/ezid-php)[ RSS](/packages/olendorf-ezid-php/feed)WikiDiscussions master Synced 2d ago

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

EZID-PHP
========

[](#ezid-php)

EZID-PHP is a simple wrapper around the Guzzle HTTP client intended to simplify interaction with the EZID DOI service. It is configurable to use your own authentication and shoulders. Its still early in development. Feel free to use it, but please be be aware there are probably issues and bugs. If you find them report them or fix them!

For further information about the EZID API visit .

Installation
------------

[](#installation)

The recommended way to install Ezid-php is through [Composer](http://getcomposer.org).

```
# Install Composer
curl -sS https://getcomposer.org/installer | php
```

Next, run the Composer command to install the latest stable version of Guzzle:

```
composer.phar require olendorf/ezid-php
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

You can then later update Guzzle using composer:

```
composer.phar update
```

**OR**

Edit your compuser.json to include the following

```
{

   "require": {
      "olendorf/ezid-php": ">=0.0.0"
    }
}
```

Configuring
-----------

[](#configuring)

Copy and rename `src/ezid/ezid.json.example` to `src/ezid/ezid.json`. Then edit it to reflect your credentials and shoulders. If upi do not wish to use the config file just delete it (or don't copy and rename in the first place). You can always override the values as you wish.

Usage
-----

[](#usage)

This package uses the Guzzle package to handle HTTP requests and is really just a wrapper for that. All methods that interact with the EZID API (i.e. that make an HTTP request) return a Guzzle response. For more information about Guzzle visit .

### Creating The Connection

[](#creating-the-connection)

```
/**
 * Using ezid.json configuration
 */
$client = new ezid\Connection();

/**
 * Overriding or not using ezid.json
 */
$config = array(
                 "username"=>"RandomCitizen",
                 "password"=>"foobar123",
                 "doi_shoulder"=>"doi:10.5072/FK2",  # optional and make sure you use the right shoulder.
                 "ark_shoulder"=>""ark:/99999/fk4"   # same as above
               );
$client = new ezid\Connection($config);
```

### Creating And Minting Identifiers

[](#creating-and-minting-identifiers)

```
 // Getting Server Status
 $response = $this->status();

 echo $response->getBody()->getContents(); // success: EZID is up

 // Creating an identifier
 $meta = [
            "creator" => 'Random Citizen',
            'title' => 'Random Thoughts',
            'publisher' => 'Random Houses',
            'publicationyear' => '2015',
            'resourcetype' => 'Text'
        ];
 $identifier = $client->doi_shoulder.uniqid(); // Just using uniqid() to generate a  unique string.
 $response = $client->create($identifier, $meta);

 echo $response->GetStatusCode();  // 201

 // Minting an identifier

 $response = $client->mint('doi', $meta);  //uses the shoulder specified in config or on creation of the client.

 echo $response->GetStatusCode();  // 201
```

### Retrieving Metadata

[](#retrieving-metadata)

```

 $response = $client->get_identifier_metadata($identifier);  // will get the meta sent in create()
 echo (string)$response->getBody();  // Key value pair formatted string with metadata
      // datacite.creator: Random Citizen
      // datacite.title : Random Thoughts
      // ...

 // You can extract this using parse_response_metadata()

 $meta_array = $client->parse_response_metadata((string)$response->getBody()); // Guzzle returns a stream, cast it to a string

 print_r($meta_array);
    // (
    //    [datacite.creator] => 'Random Citizen',
    //    [datacite.title] => 'Random Thoughts',
    //    ...
    //  )

```

### Modifying The Metadata

[](#modifying-the-metadata)

```
 $new_meta = [
            "creator" => 'Anonymous Resident',
            'resourcetype' => ''
            ];
 $response = $client->modify_identifier_metadata($identifier, $new_meta);
 echo $response->GetStatusCode()  // 200
```

### Deleting An Identifier

[](#deleting-an-identifier)

This will only work if the status of the identifier is ***reserved***.

```
 $response = $client->delete_identifier($identifier);
 echo $response->GetStatusCode()  // 200
```

Running The Tests
-----------------

[](#running-the-tests)

I used PHPSpec for testing, mostly to try it out. One issue I ran into was the difficulty in testing an external API. Rather than mocking out a web server, I just used the actual EZID service, couples with the testing shoulders they provide. If you want to run the tests, you will need to have an active EZID account, and use your credentials in the ezid.json. Also, in some cases tests may fail if the EZID service is having issues. In the future I may take the time to mock it out correctly.

Contributing
------------

[](#contributing)

Contributions are welcome. Either submit an issue, or fork the repo and then submit a Pull request.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3744d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/857767?v=4)[Robert Olendorf](/maintainers/olendorf)[@olendorf](https://github.com/olendorf)

---

Top Contributors

[![olendorf](https://avatars.githubusercontent.com/u/857767?v=4)](https://github.com/olendorf "olendorf (40 commits)")

---

Tags

apiclientresthttp clientarkdoi

### Embed Badge

![Health badge](/badges/olendorf-ezid-php/health.svg)

```
[![Health](https://phpackages.com/badges/olendorf-ezid-php/health.svg)](https://phpackages.com/packages/olendorf-ezid-php)
```

###  Alternatives

[eightpoints/guzzle-bundle

Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony. Comes with easy and powerful configuration options and optional plugins.

44512.5M57](/packages/eightpoints-guzzle-bundle)[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.7M18](/packages/xeroapi-xero-php-oauth2)[e-moe/guzzle6-bundle

Integrates Guzzle 6 into your Symfony application

12262.2k1](/packages/e-moe-guzzle6-bundle)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4640.8k](/packages/ismaeltoe-osms)[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.

188.0k1](/packages/meteocontrol-vcom-api-client)

PHPackages © 2026

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