PHPackages                             multco/bibliophpile - 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. multco/bibliophpile

ActiveLibrary

multco/bibliophpile
===================

1.0.4(3y ago)01.4kApache-2.0PHP

Since Jun 27Pushed 3y agoCompare

[ Source](https://github.com/multnomah-county-it/bibliophpile)[ Packagist](https://packagist.org/packages/multco/bibliophpile)[ RSS](/packages/multco-bibliophpile/feed)WikiDiscussions master Synced 3w ago

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

NYPL Bibliophpile
=================

[](#nypl-bibliophpile)

PHP Wrapper for [BiblioCommons](http://www.bibliocommons.com/) API

Credit
------

[](#credit)

Originally written by The New York Public Library:

Currently maintained by Multnomah County Library:

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

[](#installation)

Clone the repository, `cd` onto your cloned directory and run composer:

```
php composer.phar install
php composer.phar install --dev

```

Run tests
---------

[](#run-tests)

```
alias phpunit='php vendor/phpunit/phpunit/phpunit.php'

phpunit tests

```

or

```
phpunit --testdox tests

```

Generate Documentation
----------------------

[](#generate-documentation)

Work fine with [PHPDocumentor](http://www.phpdoc.org/) (and probably others as well).

```
phpdoc -d src -t docs

```

To install PHPDocumentor:

```
pear channel-discover pear.phpdoc.org
pear install phpdoc/phpDocumentor-alpha

```

NOTE: You may have to also install [GraphViz](http://www.graphviz.org/) in order for phpdoc to run without errors.

Run the Demo
------------

[](#run-the-demo)

If your are using PHP 5.4 or greater, you can use the built-in web server to run the demo:

```
php -S localhost:8000

```

Then go to browser and open `

Basic Usage
-----------

[](#basic-usage)

Create a client:

```
$client = new \NYPL\Bibliophpile\Client('yourapikey');

```

Via the client you can retrieve the various other BiblioCommons API resources:

```
$library = $client->library('nypl'); // Returns a Library
$locations = $client->location('nypl'); // Returns a list of Location objects
$list = $client->itemList('1234567'); // Returns an ItemList
$title = $client->title('123456789'); // Returns a Title
$titles = $client->titles('Moby Dick', 'nypl'); // Returns a list of matching Title objects
$user = $client->user('1234567'); // Returns a User
$users = $client->users('example'); // Returns a list of matching User objects
$session = $client->session('a1b2c3d4-e5f6-g7h9-i9j0-k1l2m3n4o5p6'); // Returns a Session
$borrower = $client->borrower('123456'); // Returns a Borrower

```

A note about IDs
----------------

[](#a-note-about-ids)

Many of the IDs in the examples above are clearly integer-like, but they passed and returned as strings.

Paginated Lists
---------------

[](#paginated-lists)

Some methods return `ItemLists` `Titles` or `Users` objects, which are all paginated lists. Any method that returns a paginated list takes both a `page` and a `limit` parameter for the desired page from the results (default: 1) and the number of results per page (default: 10). For example:

```
// Searches NYPL for “Moby Dick” and returns the 5th page
// with 20 items per page.
// Returns a Titles object
$client->titles('Moby Dick', 'nypl', 5, 20);

// Gets the 2nd page of lists made by the user, with the
// default 10 items per page.
// Returns a Users object.
$user->userLists('123456', 2);

```

The objects themselves share the following methods:

- `count()`: Returns the total number of items in the results
- `page()`: Returns the current page out the results
- `pages()`: Returns the number of pages in the results
- `limit()`: Returns the number of items per page
- `gotoPage(page)`: Retrieves the desired page of results.
- `next()`: Retrieves the next page of results.

Trying to get a page that does not exist (less than 1 or higher than the highest numbered page in the results) will raise a `NoSuchPageException`. Trying to get the next page when you are already at the end of the results raises an `EndOfResultsException` which can be caught and used a signal to exit a loop when fetching the entire results set.

Empty properties
----------------

[](#empty-properties)

Many objects returned by the BiblioCommons API can have empty, null, or missing properties. Nypl-bibliophpile handles all these cases by returning an empty array for properties that are expected to be arrays, or `NULL` for enything else.

Resources
---------

[](#resources)

### Libraries

[](#libraries)

Library objects can be retrieved by ID:

```
$library = $client->library('nypl');
echo $library->id(); // "nypl"
echo $library->name(); // "New York Public Library"
echo $library->catalog(); // "http://nypl.bibliocommons.com"

```

### Locations

[](#locations)

A library can have a multiple locations (basically branches). The list of a library’s locations can be retrieved from the Library object:

```
$locations = $library->locations();
echo $locations[0]->name(); // "115th Street"

```

or from the client with the library’s ID:

```
$locations = $client->locations('nypl');

```

Individual locations also occur as properties in Copy (location of a particular copy) and Borrower objects (as a borrower’s preferred location).

### Titles

[](#titles)

A “title” can be a book, a DVD, a CD, or anything that can be checked out.

Methods:

   additionalContributors() array Additional contributors as an array of names (strings)   authors() array Authors names as an array strings.     availability() Availability    callNumber() string    contents() array Table of contents as an array of strings.   copies() array An array of Copy objects.   description() string    details() string URL for the title on BiblioCommons.   edition() string   format() Format   id() string   isbns() array An array of the title's isbns as strings.   languages() array Array of the title's languages as strings.   name() string Returns the title's name (i.e. it's title, but this method can’t be called title() in order to avoid confusion with a constructor).   notes() array Notes on the title as an array of strings.   pages() int The number of pages   performers() array Title's performers and an array of strings.   physicalDescription() array Physical description of the title as an array of strings.   primaryLanguage() string   publishers() array Array of publishers names as strings.   series() array An array of Series objects.   statementOfResponsibility() string   subtitle() string   suitabilities() array An array of strings.   upcs() array The title's upcs as an array of strings.  Lists
-----

[](#lists)

BiblioCommons lists are user-generated lists of Titles

Retrieve a list by it's ID:

```
$list = $client->itemList('170265611');
echo $list->name(); // "Recommended by our librarians 4";

```

Titles
------

[](#titles-1)

Retrieve a title by its ID (NB, the IDs are numeric, but still strings):

```
$title = $client->title('18708779052907');
echo $title->name(); // "Moby-Dick";

```

Retrieve the copies of a title:

```
$copies = $title->copies(); // Array of copy objects

```

You can also get the copies from the client with the title’s ID:

```
$copies = $client->copies('18708779052907');

```

Users
-----

[](#users)

Retrieve a user by ID:

```
$user = $client->user('123456789');
echo $user->name(); // "fakeuser"

```

Search for users by username:

```
$users = $client->users('fakeuser');
$userlist = $users->users(); // array of results
count($users->users()); // 1
echo $userlist[0]->name(); // "fakeuser"

```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79% 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 ~0 days

Total

5

Last Release

1456d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/66eb7c10ca7293a303221e766b4f2e10bb5fbbac13366911eb79d8263d7c561b?d=identicon)[Greg-Boggs](/maintainers/Greg-Boggs)

---

Top Contributors

[![seanredmond](https://avatars.githubusercontent.com/u/720703?v=4)](https://github.com/seanredmond "seanredmond (98 commits)")[![Greg-Boggs](https://avatars.githubusercontent.com/u/653450?v=4)](https://github.com/Greg-Boggs "Greg-Boggs (16 commits)")[![dillonsavage](https://avatars.githubusercontent.com/u/1928493?v=4)](https://github.com/dillonsavage "dillonsavage (5 commits)")[![newsomc](https://avatars.githubusercontent.com/u/79253?v=4)](https://github.com/newsomc "newsomc (3 commits)")[![mwbenowitz](https://avatars.githubusercontent.com/u/14184380?v=4)](https://github.com/mwbenowitz "mwbenowitz (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/multco-bibliophpile/health.svg)

```
[![Health](https://phpackages.com/badges/multco-bibliophpile/health.svg)](https://phpackages.com/packages/multco-bibliophpile)
```

###  Alternatives

[kenguest/services-openstreetmap

More information available at https://pear.php.net/package/Services\_OpenStreetMap

20441.5k](/packages/kenguest-services-openstreetmap)[bearsaturday/bearsaturday

BEAR.Saturday framework

2056.3k1](/packages/bearsaturday-bearsaturday)

PHPackages © 2026

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