dev-master
9999999-devA basic Symfony bundle provide a simple way to use Google Books API.
GPL-3.0
The Requires
- php >=5.6.0
- guzzlehttp/guzzle >=6.0.0
by Jonathan Barbin
api bundle symfony books google books
Wallogit.com
2017 © Pedro Peláez
A basic Symfony bundle provide a simple way to use Google Books API.
A basic Symfony bundle provide a simple way to use Google Books API., (*1)
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*2)
$ composer require jbarbin/googlebooksbundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*3)
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php file of your project:, (*4)
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new JBarbin\GoogleBooksBundle\JBarbinGoogleBooksBundle(),
);
// ...
}
// ...
}
First at all, you need to create an api key on google developer console on https://console.developers.google.com. You have to activate Google Books API on your project and create an api key., (*5)
# app/services.yml
parameters:
// ...
jbarbin_googlebooks.google_api_key: ???????????????????????????
// Use statement
use JBarbin\GoogleBooksBundle\GoogleAPI\Query;
// ...
$googleAPI = $this->get('jbarbin_googlebooks_api');
$api_key = $this->container->getParameter('jbarbin_googlebooks.google_api_key');
$query = new Query($api_key);
// Search by title
$query->setTitle('book title');
// Search by author
$query->setTitle('book author');
// Get results
$books = $googleAPI->searchBook($query);
A basic Symfony bundle provide a simple way to use Google Books API.
GPL-3.0
api bundle symfony books google books