cdburgess / bggapi
PHP Library - BoardGameGeek XML API2
Requires
- php: >=8.3
- ext-simplexml: *
Requires (Dev)
- mockery/mockery: ^1.6
- pestphp/pest: ^3.7
- squizlabs/php_codesniffer: ^3.11
This package is auto-updated.
Last update: 2025-01-21 00:19:02 UTC
README
This project provides several request classes to interact with the BGG XML API2. Below are examples of how to run each type of request.
Requests
To submit a request to an endpoint on BoardGameGeek, simply create the request
resource for the endpoint you desire. For example, if you want to request a specific
board game, you create the thing
request as follows:
$thing = new Thing();
Once you have the request object, you can set the various parameters for that request
by referencing the method of the parameter name. For example, if you want to request
the Nemesis (2018)
board game, you set the id as follows:
$this->id(167355);
To send the request to the API, simply call send.
$data = $thing->send();
You can also combine this into a single request.
$thing = new Thing(); $data = $thing->id(167355) ->send();
Data Formats
By default, the request will return a SimpleXMLElement
file.
There are two other supported formats: array and JSON. You can request
these formats by calling their supported to
methods.
$thing = new Thing(); $dataArray = $thing->id(167355) ->toArray() ->send();
$thing = new Thing(); $dataJson = $thing->id(167355) ->toJson() ->send();
Request Options
$collection = new Collection(); $family = new Family(); $forumList = new ForumList(); $forum = new Forum(); $hot = new Hot(); $plays = new Plays(); $search = new Search(); $thing = new Thing(); $thread = new Thread(); $user = new User();