Search code examples
phplaravelsteamsteam-condenser

steam-condenser: Trying to get property of non-object


Using steam condenser with laravel 4 and installed it via composer.

I am trying to get the players inventory for dota2. I tried:

WebApi::setApiKey('*******');
$inventory = DotA2Inventory::createInventory('username');

But it gives me:

Class 'DotA2Inventory' not found

I am doing this on my User Controller.

Here is the inventory class, and here is the dota2 inventory class.

I am just trying to extract the inventory of the user so I can display it, complete with image, name, rarity and other item info.


UPDATE

So I have found that I forgot to add this:

require_once STEAM_CONDENSER_PATH . 'steam/community/GameInventory.php';

Now with that I am getting another error: Trying to get property of non-object

protected function _getJSONData($interface, $method, $version = 1, $params = null) {
    $data = $this->getJSON($interface, $method, $version, $params);
    $result = json_decode($data)->result;

Additional Info

I am working with version 1.3.7 of steam-condenser. (checked my steam-condenser.php to confirm this)

The error is "Trying to get property of non-object" on line 190 of WebApi.php

$result = json_decode($data)->result;

Specifically was trying to get the dota 2 inventory of the user 76561198115395760.


Solution

  • Having a look at the answer to this question and your issue on GitHub this may be caused by your PHP environment (WAMP) on Windows.

    Please try using XAMPP (or a manual installation).