Download the PHP package da-mitchell/steam-api without Composer
On this page you can find all versions of the php package da-mitchell/steam-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download da-mitchell/steam-api
More information about da-mitchell/steam-api
Files in da-mitchell/steam-api
Package steam-api
Short Description PHP wrapper for the steam web API
License BSD-2-Clause
Homepage https://github.com/DaMitchell/steam-api-php
Informations about the package steam-api
Steam API Wrapper
A PHP wrapper for the Steam API
It would be great to hear from people that are actively using this. Here is a link to Gitter https://gitter.im/DaMitchell/steam-api-php.
This is v2 of the library and it is pretty much a rewirte that makes it more flexible. It will allow you to do whatever you want to the response whether that is to get an array of map the response onto an object.
I have based all the available commands on what is documented here https://lab.xpaw.me/steam_api_documentation.html.
Installation
Install the latest version using Composer by running composer require da-mitchell/steam-api
Usage
Configuration
Two parameters can be passed to the Configuration
object:
- steam_key, the API key you can get from http://steamcommunity.com/dev/apikey.
- base_steam_api_url, an optional parameter to override
http://api.steampowered.com
as the base API URL.
As shown above you can set the Steam API key by passing it into the
Configuration
constructor:
Command
Commands are the essentially classes that describe each endpoint. Each command implements Steam\Command\CommandInterface
and has methods that will give the runners its interface, method, version, HTTP method and any params the endpoint requires.
I have implemented all commands for all the of the GET endpoints. Im not really sure which POST ones to implements since I am not really sure how some of them work. So if anyone understands them please implement them and put in a PR and I will add them in..
Runners
So runners are pretty simple objects, they implement Steam\Runner\RunnerInterface
which has 3 methods, the most important being run
. They other 2 are for setting the config object,
The run method has 2 arguments, $command
and $result
. Obviously $command
is the endpoint you request on and $result
is the result of the previous runner. This means that the $result
of the first runner attached will be null.
Tests
Run the tests from the project root with php vendor/bin/phpunit