PHP code example of relisoft / php-steam-user-library
1. Go to this page and download the library: Download relisoft/php-steam-user-library library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
relisoft / php-steam-user-library example snippets
public function renderSingle()
{
$player = new Player("76561198151608925");
$request = new Request();
$request->getPlayerFriends($player,2);
$request->getPlayerRecentlyPlayedGames($player);
$request->getPlayerInventory($player,Games::CSGO);
Dumper::dump($player);
}
public function renderSingle()
{
$player = new Player("76561198151608925");
$request = new Request();
$player = $request->getFullData($player); // This function will load full profile (profile, recent games, friends, inventory)
$this->template->items = $player->getInventory()->getData();
}
$this->login = new Login($this->session->getSection("steam"));
OR
$this->login = new Login($_SESSION);
public function handleLogin()
{
$login = $this->login;
if($login->isLogged()) // If is use logged in
{
$this->flashMessage("User is logged."); //Flash message like echo
$this->redirect("single",$this->session->getSection("steam")->user); // This you can edit for your purpose
}
else
{
$object = $login->auth(); // Auth user and return states
if($object) //IF SUCCESS RETURN STEAM ID
{
$this->flashMessage("successfuly logged in $object"); //Echo some text
$this->redirect("single",$object); // Redirect to another page with parameter $object -> returning STEAM ID
}
elseif($object == $login::FAILED)
{
$this->flashMessage("Steam is not logged in!"); //Echo that's failed
$this->redirect("this"); //Redirect
}
elseif($object == $login::CANCEL) //Echo that's your cancel process
{
$this->flashMessage("Cancel by user");
$this->redirect("this");
}
}
}