This library provides an easy way to access the public Steam Inventory API (https://steamcommunity.com/inventory/) from your PHP code. It provides a simple interface to retrieve a Steam user's inventory from the API with information about the items in it.
Using this API does not require an API key, but as it is not part of the Steam Web API, the rate limit of 100,000 requests per day does not apply. Instead, the rate limit for this API is extremely low. So use this API or rather this library with caution.
While using this API is generally discouraged, it has been part of Steam since forever and despite or perhaps because its rework in 2016, it is probably here to stay.
The library is designed to be easily extendable by other developers. It should be well documented and includes a comprehensive test suite.
- PHP >= 8.1
This library supports all officially and actively supported PHP versions.
See the composer.json
for other requirements.
composer require iceq1337/php-steam-inventory
use SteamInventory\Inventory;
$options = [
'steamid' => '76561198129782984',
'appid' => 753, // default: 753
'contextid' => 6, // default: 6
'language' => 'english', // default: 'english'
'all_items' => false, // default: false
'count' => 100, // default: 500, max: 5000
'start_assetid' => null, // default: null, used for consecutive requests
];
$inventory = new Inventory($options);
$items = $inventory->getItems();
$total = $inventory->total_inventory_count;
foreach ($items as $item) {
echo $item->getName() . "<br>";
}
There are currently no contributing guidelines. In order to contribute to the project, please follow the GitHub Standard Fork & Pull Request Workflow.
- Fork this repository on GitHub.
- Clone the project to your own machine.
- Commit changes to your own branch.
- Push your work to your own fork.
- Submit a Pull Request so I can review your changes
Please make sure you always run the tests and apply the code style before submitting your pull request. All tests and the code style workflow must pass in order for the pull request to be approved and merged.
composer run test
composer run lint
This library is licensed under the MIT license.
Parts of this library are based on PHP Steam Inventory published by matthewlilley in 2018.