Skip to content

dananichev/steam-api-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Steam API Wrapper Build Status

A PHP wrapper for the Steam API

Usage

<?php

use JMS\Serializer\SerializerBuilder;
use Steam\Adapter\Guzzle;
use Steam\Configuration;
use Steam\Api\User;

$config = new Configuration(array(
    'steamKey' => '{STEAM_KEY}',
));

$adapter = new Guzzle($config);
$adapter->setSerializer(SerializerBuilder::create()->build());

$user = new User();
$user->setAdapter($adapter);

$result = $user->getFriendList(76561198049450178);

Configuration

The configuration object has 3 options:

Adapters

Adapters here are the classes that make the requests to the Steam API. They must implement \Steam\Adapter\AdapterInterface. They can also, but are not required to, extend \Steam\Adapter\AdapterAbstract, which just has some useful properties and methods.

I have implemented one adapter so far which makes use of the https://github.com/guzzle/guzzle library. The constructor of the class takes in the configuration object describes in the previous section. Another library the Guzzle adapter makes use of is the http://jmsyst.com/libs/serializer from Johannes Schmitt.

Endpoints

Obviously each endpoint is described in a class matching up to what is described in the Steam API. Each one of those classes then has the adapter set using the setAdapter method which will handle all the magic of getting the response.

At the minute each method will called getParsedBody, which I am not sure everyone will want but at the minute it makes sense to have it so you get the deserialised version of the response. In future releases I may change it so the adapter is returned instead.

About

A PHP wrapper for the Steam api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%