An Open Brewery DB API client for PHP.

0.9.0 2024-03-16 00:18 UTC

This package is auto-updated.

Last update: 2024-04-25 17:30:37 UTC



badge.svg 68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3734373032303731382f736869656c643f7374796c653d666c6174

(Un)official PHP bindings for the Open Brewery DB API. Open Brewery DB provides a public dataset for breweries around the world, as well as offering an API to retrieve data in various forms. This library aims to provide straight and easy-to-use PHP bindings for querying the API. The library is inspired by the Open AI client for PHP - please give it star as well!

To get started, first install the package with composer:

$ composer require joeymckenzie/openbrewerydb-php-client

Next, spin up a new client within your code and fire away!



require_once __DIR__.'/../vendor/autoload.php';

use OpenBreweryDb\OpenBreweryDb;

$client = OpenBreweryDb::client();

// Get a list of breweries, based on all types of different search criteria
$breweries = $client->breweries()->list([
    'by_city' => 'Sacramento',

// Retrieve various metadata about breweries from the API
$metadata = $client->breweries()->metadata();

// Get a random brewery with a specified page size
$randomBrewery = $client->breweries()->random(5);

The library relies on autodiscovery and will use whichever package that implements PSR-17 within your composer dependencies. You are free to use the HTTP client of you choice, though a popular package is Guzzle.

Though I am not affiliated with organization itself, check out the entire set of APIs offered by Open Brewery DB, check out the docs on their website.