PHPackages                             danielmagacf/steam-trade - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. danielmagacf/steam-trade

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

danielmagacf/steam-trade
========================

0521PHP

Since Dec 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/danielmagacf/steam-trader)[ Packagist](https://packagist.org/packages/danielmagacf/steam-trade)[ RSS](/packages/danielmagacf-steam-trade/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

\#this package is just a wrapper

To install

```
composer require danielmagacf/steam-trade

```

To use

Danielmagacf\\SteamTrade\\SteamTrader::get($sessionId, $cookiesArray);

php-steam-tradeoffers
=====================

[](#php-steam-tradeoffers)

Steam Trade Offers library for PHP (based on node.js library by Alex7Kom)

All the same functions as in [Alex7Kom library](https://github.com/Alex7Kom/node-steam-tradeoffers)

**Note**: By using this library you automatically agree to [Steam API Terms of Use](https://steamcommunity.com/dev/apiterms)

Installation
============

[](#installation)

```
require_once 'classes/steam.class.php'

```

Usage
=====

[](#usage)

Instantiate a steam object...

```
$steam = new SteamTrade();
```

...then setup session:

```
$steam->setup('sessionID', 'cookies');
```

This setup will automatically register and retrieve Steam API key for you.

Methods
=======

[](#methods)

The first param for all methods (except setup) is an associative array of options.

setup(sessionId, cookies)
-------------------------

[](#setupsessionid-cookies)

As noted above, this method is used to setup a web session. It also tries to retrieve Web API key.

Options:

- `sessionID` is a valid web session ID.
- `webCookie` is an array of cookies.

If failed to retrieve Web API key due to [limited account](https://support.steampowered.com/kb_article.php?ref=3330-IAGK-7663), `setup` will throw the error.

loadMyInventory(options)
------------------------

[](#loadmyinventoryoptions)

Loads your inventory for the given app and context. For example, use 440 and 2 for TF2 and 570 and 2 for Dota 2.

Options:

- `appId` is the Steam AppID
- `contextId` is the inventory context Id
- `language` (optional) is the language for item descriptions
- `tradableOnly` (optional) is a boolean flag that defaults to `true` to return tradable items only

loadPartnerInventory(options)
-----------------------------

[](#loadpartnerinventoryoptions)

Loads your partner inventory for the given app and context.

Options:

- `partnerSteamId` is the SteamID of the trade partner
- `appId` is the Steam AppID
- `contextId` is the inventory context Id
- `tradeOfferId` (optional) is needed to load private inventory of the trade partner for received trade offer
- `language` (optional) is the language for item descriptions

makeOffer(options)
------------------

[](#makeofferoptions)

Makes a trade offer to the partner.

Options:

- `partnerAccountId` or `partnerSteamId`, you need only one of those.
- `accessToken` (optional) is a token from the public Trade URL of the partner.
- `itemsFromMe` are the items you will lose in the trade.
- `itemsFromThem` are the items you will receive in the trade.
- `counteredTradeOffer` (optional) is the ID to a trade offer you are countering.
- `message` (optional) is a message to include in the offer.

`itemsFromMe` and `itemsFromThem` both are arrays of item objects that look like this:

```
array(
    "appid" => 440,
    "contextid" => 2,
    "amount" => 1,
    "assetid" => "1627590398"
)
```

If success it will return an object with `tradeofferid` of the newly created trade offer.

getOffers(options)
------------------

[](#getoffersoptions)

getOffer(options)
-----------------

[](#getofferoptions)

The first method loads a list of trade offers, and the second loads just a single offer.

Options:

- See [Steam Web API/IEconService](https://developer.valvesoftware.com/wiki/Steam_Web_API/IEconService).

In return you will get an object that Steam Web API returns. The only thing to note is that the wrapper adds a property `steamid_other` with the SteamID of the trade partner to each `CEcon_TradeOffer` object in received trades.

declineOffer(options)
---------------------

[](#declineofferoptions)

acceptOffer(options)
--------------------

[](#acceptofferoptions)

cancelOffer(options)
--------------------

[](#cancelofferoptions)

`declineOffer` or `acceptOffer` that was sent to you. `cancelOffer` that you sent.

Options:

- `tradeOfferId` is a trade offer Id

In return you will get an object with response from Steam, but don't expect anything meaningful in it.

getOfferToken()
---------------

[](#getoffertoken)

In return you will get the offer token of the bot, extracted from its trade offer URL.

getItems(options)
-----------------

[](#getitemsoptions)

Options:

- `tradeId` is the ID of the completed trade you want to get items for, available as a `tradeid` property on offers from `getOffers` or `getOffer`

In return you will get an array of items acquired in a completed trade.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab1a71ed1cb53080827b8b5e4e6a46e9a7e720e9d3e05e0cb11801b2561aed09?d=identicon)[danielmagacf](/maintainers/danielmagacf)

---

Top Contributors

[![danielmagacf](https://avatars.githubusercontent.com/u/112487399?v=4)](https://github.com/danielmagacf "danielmagacf (1 commits)")[![magadanuhak](https://avatars.githubusercontent.com/u/32567230?v=4)](https://github.com/magadanuhak "magadanuhak (1 commits)")

### Embed Badge

![Health badge](/badges/danielmagacf-steam-trade/health.svg)

```
[![Health](https://phpackages.com/badges/danielmagacf-steam-trade/health.svg)](https://phpackages.com/packages/danielmagacf-steam-trade)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
