Download the PHP package scriptotek/google-books without Composer
On this page you can find all versions of the php package scriptotek/google-books. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download scriptotek/google-books
More information about scriptotek/google-books
Files in scriptotek/google-books
Package google-books
Short Description Package for interacting with the Google Books API
License ISC
Homepage http://github.com/scriptotek/google-books
Informations about the package google-books
php-google-books
Simple PHP package for working with the Google Books API. With Laravel5 integration. Doesn't yet support authentication, so it only works with public data. PRs are welcome.
Install using Composer
Make sure you have Composer installed, then run
in your project directory to get the latest stable version of the package.
Usage
Start by creating a new client:
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
Getting a single volume by id:
or by ISBN:
Search:
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
Getting a single bookshelf by user id and shelf id:
List the public bookshelves of a user, and their volumes:
Laravel 5 integration
This project ships with a service provider that you can add to the
$providers
array in your config/app.php
:
Scriptotek\GoogleBooks\GoogleBooksServiceProvider::class,
There's also a facade you can add to the $aliases
array if you like:
'GoogleBooks' => Scriptotek\GoogleBooks\GoogleBooksFacade::class,
Run
$ php artisan vendor:publish --provider="Scriptotek\GoogleBooks\GoogleBooksServiceProvider"
to create the config/googlebooks.php
configuration file.
Troubleshooting
If you get 403 Forbidden with
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: