PHPackages                             joshbannon/overdrive-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. [API Development](/categories/api)
4. /
5. joshbannon/overdrive-client

ActiveLibrary[API Development](/categories/api)

joshbannon/overdrive-client
===========================

An API client for overdrive.com

v0.8.0(10y ago)337MITPHPPHP &gt;=5.5.0

Since May 31Pushed 10y ago3 watchersCompare

[ Source](https://github.com/joshbannon/overdrive-php-client)[ Packagist](https://packagist.org/packages/joshbannon/overdrive-client)[ RSS](/packages/joshbannon-overdrive-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

OverDrive PHP Client
====================

[](#overdrive-php-client)

The OverDrive PHP Client provides an easy way to use overdrive.com to query library and patron information, place checkouts and holds, check availability, and download titles. OverDrive did an exceptional job making a robust, easy to use api, but they didn't provide a reference client library. You can use this library in your PHP based discovery layer, or just treat it as a starting point for a project in another language.

This client is fairly feature complete, but it isn't perfect. Desired enhancements could include additional exception cases and perhaps async methods that return promises. That was the originally intended path, but the client proved to be pretty performant even with serial calls, so that work was never completed.

There are also many small features that might be useful to some organizations, but were never added due to lack of need. For instance, the patron's password is not currently used because most organizations ask OverDrive to ignore the pin/password. Search is also just barely stubbed out because it's expected that you are doing your own searching locally.

If you'd like to help out and submit a pull request, it would be welcome.

Additional test methods would also be welcome. Currently testing consists of a small functional suite that serves to spot check features and demonstrate the basic use of the client.

Using the Client
----------------

[](#using-the-client)

The library is broken up into a "Library Client" and a "Patron Client". The library client queries basic item information like the number of copies owned and the number available, the formats available for an item, and meta-data for an item like description and cover images.

```
// Connect to Memcache:
$cache = new \Memcached\Wrapper("defaultPool", array(array("localhost", 11211)));

//Instantiate Library Client
$client = new OverDriveLibraryAPIClient(
            new \GuzzleHttp\Client(),
            $libraryAuthUrlBase, //https://oauth.overdrive.com
            $libraryAPIUrlBase, //http://api.overdrive.com
            //Provided by OverDrive. Identifies the collection owned by the library.
            //It appears to be technically possible for a library to have more than one collection with OverDrive.
            $collectionId,
            $cache);
//Login() stores an access token for subsequent calls. Automatically handles timeout.
$client->login($clientKey, $clientSecret);
$totalCopies = $client->getTotalCopies($itemId);
$numAvailable = $client->getAvailable($itemId);
```

The patron client (OverDrivePatronAPIClient) extends the library client (OverDriveLibraryAPIClient). It needs all the standard configuration for the library client and additionally requires the patron's barcode and an email address. The patron client can checkout and return titles, create and release holds, and download checked out titles.

```
//Instantiate Patron Client
$client = new OverDrivePatronAPIClient(
            new \GuzzleHttp\Client(),
            $patronAuthUrlBase,
            $patronAPIUrlBase,
            $libraryAuthUrlBase,
            $libraryAPIUrlBase,
            $collectionId,
            $websiteId,
            $ilsId,
            $notificationEmail,
            $cache);
//Login() stores an access token for subsequent calls. Automatically handles timeout.
$client->login($clientKey, $clientSecret, $username); //$username is generally the patron's barcode
$totalCopies = $client->getTotalCopies($itemId);
$numAvailable = $client->getAvailable($itemId);
$loanOptionsCollection = $client->getLoanOptions($itemId);
$loanOption = $loanOptionsCollection->getLoanOptions()[0]; //Format choice is unimportant for holds. Just take the first
$hold = $client->holdItem($loanOption)
```

A "Factory" class is also included in the package largely as a reference. It depends on the global $config and $cache that was available in an experimental VuFind branch. It may be useful in your project with minor tweaks.

Installing the client
---------------------

[](#installing-the-client)

The recommended method is to use composer [Composer](http://getcomposer.org).

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

Next, run the Composer command to install the client:

```
composer.phar require joshbannon/overdrive-client
```

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

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

Acknowledgments
---------------

[](#acknowledgments)

This package was based on the Douglas County Libraries' experimental e-content-enabled VuFind project. It would not have been possible without their support.

The OverDrive client depends on a number of other packages. In particular it uses the excellent Guzzle package to handle HTTP connections. I found the Guzzle project to be useful not only for its fantastic capabilities, but also as a guide to project structure. PHP is not really my forte these days, and I made heavy use of their readme.md and composer.json as a template for my own project.

Code Quality Analysis
---------------------

[](#code-quality-analysis)

I thought this was a really useful tool, so I'll leave a link here to help you decide whether to use this library in your project. It rightfully points out that I have a bunch of debug helpers commented out, and that I have a number of TODO items.

[![SensioLabsInsight](https://camo.githubusercontent.com/025d9024d4a902da65caa668bb01140264ed5fddf3aed1a4a031c15ff49cebef/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f64623239633235612d333236372d346332392d393633372d3361336530616566623432312f6d696e692e706e67)](https://insight.sensiolabs.com/projects/db29c25a-3267-4c29-9637-3a3e0aefb421)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

4006d ago

### Community

Maintainers

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

---

Tags

librarylibrariese-contentecontentoverdrive

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/joshbannon-overdrive-client/health.svg)

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

###  Alternatives

[alibabacloud/client

Alibaba Cloud Client for PHP - Use Alibaba Cloud in your PHP project

2223.5M367](/packages/alibabacloud-client)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)[telegram-bot-php/core

A PHP library that makes using Telegram Bot API much easier.

60293.1k](/packages/telegram-bot-php-core)[maxbeckers/amazon-alexa-php

Php library for amazon echo (alexa) skill development.

11554.0k2](/packages/maxbeckers-amazon-alexa-php)[fabian-beiner/todoist-php-api-library

A PHP client library that provides a native interface to the official Todoist REST API.

4810.8k](/packages/fabian-beiner-todoist-php-api-library)[leochien/laravel-spgateway

spgateway library for laravel

3611.1k](/packages/leochien-laravel-spgateway)

PHPackages © 2026

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