Download the PHP package billythekid/punk-api without Composer
On this page you can find all versions of the php package billythekid/punk-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download billythekid/punk-api
More information about billythekid/punk-api
Files in billythekid/punk-api
Package punk-api
Short Description PHP Wrapper for the Punk API https://punkapi.com
License MIT
Informations about the package punk-api
PunkApi
PHP wrapper to query the PunkAPI https://punkapi.com by Sam Mason
Full API docs for this project available at https://billythekid.github.io/PunkApi/class-billythekid.PunkApi.html
Installation
via composer composer require billythekid/punk-api
Usage
Create a new instance of the client
or
Methods
Returns the current endpoint that will be hit based on the options provided. Good to check what'll be hit without actually hitting it. This method is not chainable.
-
This method is chainable.
Add parameters to the search. The following parameter keys are supported:
abv_gt
number Returns all beers with ABV greater than the numberabv_lt
number Returns all beers with ABV less than the numberibu_gt
number Returns all beers with IBU greater than the numberibu_lt
number Returns all beers with IBU less than the numberebc_gt
number Returns all beers with EBC greater than the numberebc_lt
number Returns all beers with EBC less than the numberbeer_name
string Returns all beers matching the supplied name (this will match partial strings as well so e.g punk will return Punk IPA)yeast
string Returns all beers matching the supplied yeast name, this also matches partial stringsbrewed_before
date(string) Returns all beers brewed before this date, the date format is mm-yyyy e.g 10-2011brewed_after
date(string) Returns all beers brewed after this date, the date format is mm-yyyy e.g 10-2011hops
string Returns all beers matching the supplied hops name, this also matches partial stringsmalt
string Returns all beers matching the supplied malt name, this also matches partial stringsfood
string Returns all beers matching the supplied food string, this also matches partial stringspage
number Return the beers from the page given (responses are paginated)per_page
number Change the number of beers returned per page (default - 25)ids
string New for V2 - pipe separated string of ID numbers (192|224 etc)
The following chainable methods can be used to alter the parameters if you prefer
Examples
Removes parameters from the search. This method is chainable
Example
-
Empties all the parameters. This method is chainable.
Example
-
Perform a query on the API, returns an array of beers.
Example
-
Pull a random beer from the API or pull a specific beer from the API by it's ID number
Example
Changelog
v 1.1.2 - Mar 23, 2017
- Bugfix - not passing a param to :create() threw an error
v 1.1.1 - Feb 10, 2017
- Bugfix - perPage() wasn't working properly
- Added more tests
v 1.1.0 - Feb 10, 2017
- Non-breaking update to use version 2 of the Punk Api by default
- Updated docs and readme
- Added
->ids()
endpoint andids
paramater - Added tests
v 1.0.0 - Oct 15, 2016
- Initial release