PHP code example of joeymckenzie / openbrewerydb-php-api

1. Go to this page and download the library: Download joeymckenzie/openbrewerydb-php-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

joeymckenzie / openbrewerydb-php-api example snippets




declare(strict_types=1);

;

$client = OpenBreweryDb::client();

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

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

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