alexjustesen/php-untappd

Unofficial PHP SDK for Untappd

v0.1.0 2023-03-19 20:03 UTC

This package is not auto-updated.

Last update: 2024-11-12 02:20:16 UTC


README

Unofficial PHP SDK for Untappd API.

Sponsor

Like this package? Consider sponsoring me to help me reach my goals.

Install

composer require alexjustesen/php-untappd

Usage

Authentication

The Untappd API makes use of token based authentication, you can either generate a token using your client ID and secret or using the SSO user's token.

Initialize the request

To get started create a new instance of the SDK.

$untappd = new Untappd();

Handling the response

The SDK makes use of Saloon by Sam Carre, after a request is sent you can interact with the response with any of the documented methods like ->body() or ->json().

In the example below we're requesting a single beer and formatting the response as json.

$request = new GetBeer('beer-id-goes-here');

$response = $untappd->send($request);

$response->json();

Get a beer

$request = new GetBeer('beer-id-goes-here');

$response = $untappd->send($request);

Search for beer

$request = new SearchBeer('brewery name or beer name string');

$response = $untappd->send($request);

Testing

Using PHP CS Fixer

composer fix-code

Using Pest

composer test