Composer package for implementing the BreweryDB API in Laravel, using Guzzle (version 4) for retrieval and caching.
'Beerguide\Brewerydb\BrewerydbServiceProvider'
'Brewerydb' => 'Beerguide\Brewerydb\Client'
Place the following in your controller.
$query = new Brewerydb('your-api-key');
// If API is online
if ($query) {
$params = array(
'format' => 'json',
'withBreweries' => 'Y',
'p' => $page_number,
'status' => 'verified'
);
$results = $query->request('beers', $params, 'GET', true);
$number_of_pages = $results['numberOfPages'];
$total_results = $results['totalResults'];
$per_page = count($results['data']);
$data = $results['data'];
$beers = Paginator::make($data, $total_results, $per_page);
} else {
// API is offline
}