liamthegrey/brewerydb-php

此包的最新版本(dev-master)没有可用的许可证信息。

BreweryDB的PHP包装器。从官方仓库分支而来。

dev-master 2015-05-22 22:08 UTC

This package is not auto-updated.

Last update: 2024-10-02 08:43:01 UTC


README

This service is a simple PHP wrapper for the Brewerydb.com API.


Usage:

$bdb = new Pintlabs_Service_Brewerydb($apikey);
$bdb->setFormat('php'); // if you want to get php back.  'xml' and 'json' are also valid options.

Then you can call the API:

try {
    // The first argument to request() is the endpoint you want to call
    // 'brewery/BrvKTz', 'beers', etc.
    // The third parameter is the HTTP method to use (GET, PUT, POST, or DELETE)
    $results = $bdb->request('beers', $params, 'GET'); // where $params is a keyed array of parameters to send with the API call.
} catch (Exception $e) {
    $results = array('error' => $e->getMessage());
}