PHPackages                             angelleger/google-books - 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. angelleger/google-books

ActiveLibrary[API Development](/categories/api)

angelleger/google-books
=======================

Package for interacting with the Google Books API

13741PHP

Since Oct 1Pushed 3y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/7b8bea0cf6f57a821f30abf554fabd79df6a44ae04858ad0d6e954337fad5ce9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7363726970746f74656b2f7068702d676f6f676c652d626f6f6b732e737667)](https://travis-ci.org/scriptotek/php-google-books)[![Scrutinizer code quality](https://camo.githubusercontent.com/88d01c3623de60824cda5aec1366cf11edec29d850d0121524512716a060ac3a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7363726970746f74656b2f7068702d676f6f676c652d626f6f6b732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/scriptotek/php-google-books/?branch=master)[![Packagist](https://camo.githubusercontent.com/a2da00d5ec90b9e67271ffd8f857a9261aa55cd0618b3b72738186bcb16ad127/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7363726970746f74656b2f676f6f676c652d626f6f6b732e737667)](https://packagist.org/packages/scriptotek/google-books)[![Gitter](https://camo.githubusercontent.com/ba3ad5f26a1c77d736b9a377838471e188fe17be3c74a01afa5910ea1f239a7e/68747470733a2f2f6261646765732e6769747465722e696d2f7363726970746f74656b2f7068702d676f6f676c652d626f6f6b732e737667)](https://gitter.im/scriptotek/php-google-books?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

php-google-books
================

[](#php-google-books)

Simple PHP package for working with the [Google Books API](https://developers.google.com/books/docs/v1/reference/). With Laravel5 integration. Doesn't yet support authentication, so it only works with public data. PRs are welcome.

### Install using Composer

[](#install-using-composer)

Make sure you have [Composer](https://getcomposer.org) installed, then run

```
composer require scriptotek/google-books
```

in your project directory to get the latest stable version of the package.

Usage
-----

[](#usage)

Start by creating a new client:

```
require_once('vendor/autoload.php');
use Angelleger\GoogleBooks\GoogleBooks;

$books = new GoogleBooks(['key' => 'YOUR_API_KEY_HERE']);
```

Note that you can also use the API without specifying an API key, but you will then get a lower request quota. A `UsageLimitExceeded`exception is thrown when you reach the quota.

### Working with volumes

[](#working-with-volumes)

Getting a single volume by id:

```
$volume = $books->volumes->get('kdwPAQAAMAAJ');
```

or by ISBN:

```
$volume = $books->volumes->byIsbn('0521339057');
```

Search:

```
foreach ($books->volumes->search('Hello world') as $vol) {
    echo $vol->title . "\n";
}
```

Note that the `search()` method returns a generator that automatically fetches more results until the result list is depleted. If there are thousands of results this will of course take a *long*time to fetch, so you probably want to define a limit. Limits can be defined as an option: `['maxResults' => 10]` inside the `GoogleBooks` class.

### Working with bookshelves

[](#working-with-bookshelves)

Getting a single bookshelf by user id and shelf id:

```
$shelf = $books->bookshelves->get('113555231101190020526', '1002');
```

List the public bookshelves of a user, and their volumes:

```
foreach ($books->bookshelves->byUser('113555231101190020526') as $shelf) {
    echo "$shelf->title\n";
    echo "\n";
    foreach ($shelf->getVolumes() as $vol) {
        echo "  $vol->title\n";
    }
    echo "\n";
}
```

Laravel 5 integration
---------------------

[](#laravel-5-integration)

This project ships with a service provider that you can add to the `$providers` array in your `config/app.php`:

```
Angelleger\GoogleBooks\GoogleBooksServiceProvider::class,

```

There's also a facade you can add to the `$aliases` array if you like:

```
'GoogleBooks' => Angelleger\GoogleBooks\GoogleBooksFacade::class,

```

Run

```
$ php artisan vendor:publish --provider="Angelleger\GoogleBooks\GoogleBooksServiceProvider"

```

to create the `config/googlebooks.php` configuration file.

Troubleshooting
---------------

[](#troubleshooting)

If you get 403 Forbidden with

```
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "unknownLocation",
    "message": "Cannot determine user location for geographically restricted operation."
   }
  ],
  "code": 403,
  "message": "Cannot determine user location for geographically restricted operation."
 }
}
```

it means the Books API failed to locate you based on your ip address. Fix this by specifying the 2 letter ISO639 country code manually using the `country`option to the constructor:

```
$books = new GoogleBooks(['country' => 'NO']);
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

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

---

Top Contributors

[![danmichaelo](https://avatars.githubusercontent.com/u/434495?v=4)](https://github.com/danmichaelo "danmichaelo (14 commits)")[![angelleger](https://avatars.githubusercontent.com/u/8051940?v=4)](https://github.com/angelleger "angelleger (3 commits)")[![josephmancuso](https://avatars.githubusercontent.com/u/20172538?v=4)](https://github.com/josephmancuso "josephmancuso (2 commits)")[![MacFJA](https://avatars.githubusercontent.com/u/1475671?v=4)](https://github.com/MacFJA "MacFJA (1 commits)")[![mrcage](https://avatars.githubusercontent.com/u/1665428?v=4)](https://github.com/mrcage "mrcage (1 commits)")

### Embed Badge

![Health badge](/badges/angelleger-google-books/health.svg)

```
[![Health](https://phpackages.com/badges/angelleger-google-books/health.svg)](https://phpackages.com/packages/angelleger-google-books)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M453](/packages/google-gax)

PHPackages © 2026

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