Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chipslays/steam-client
🎮 WIP: Steam Client for manage account, trade offers and more.
https://github.com/chipslays/steam-client
client library steam steam-api
Last synced: 6 days ago
JSON representation
🎮 WIP: Steam Client for manage account, trade offers and more.
- Host: GitHub
- URL: https://github.com/chipslays/steam-client
- Owner: chipslays
- License: mit
- Created: 2020-11-13T19:41:24.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-06T10:09:05.000Z (almost 4 years ago)
- Last Synced: 2024-04-19T13:21:28.593Z (7 months ago)
- Topics: client, library, steam, steam-api
- Language: PHP
- Homepage:
- Size: 42 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WIP: PHP Steam Client
Work in progress## Installation
```bash
$ composer require chipslays/steam-client
```## Example
Simple auth in CLI:
```php
// steam.phpuse Steam\Auth;
use Steam\Client;require 'vendor/autoload.php';
$client = new Client([
'username' => 'gaben',
'password' => 'hackmedaddy',
'sessionDir' => __DIR__ . '/storage/sessions',
]);$tryAuthCount = 0;
if (!$client->isLoggedIn()) {
$auth = $client->auth();
while ($auth['code'] !== Auth::SUCCESS) {
if (++$tryAuthCount >= 5) {
throw new Exception('To many auth fails. For this you can get banned by IP if you continue.');
}
switch ($auth['code']) {
case Auth::CAPTCHA:
cli()->yellow()->out($auth['response']->get('message'));
$captchaLink = $client->getCaptchaLink();
cli()->yellow()->out($captchaLink);
$input = cli()->input('>>> Enter captcha code:');
$captchaResolveText = $input->prompt();
$client->setCaptchaText($captchaResolveText);
$auth = $client->auth();
break;
case Auth::EMAIL:
$input = cli()->input('>>> Enter e-mail code:');
$emailCode = $input->prompt();
$client->setEmailCode($emailCode);
$auth = $client->auth();
break;
case Auth::TWO_FACTOR:
cli()->yellow()->out($auth['response']->get('message'));
$input = cli()->input('>>> Enter 2FA code:');
$twoFactorCode = $input->prompt();
$client->setTwoFactorCode($twoFactorCode);
$auth = $client->auth();
case Auth::FAIL:
print_r($auth);
throw new Exception('Fail auth.');
break;case Auth::BAD_RSA:
throw new Exception('Fail RSA');
break;case Auth::THROTTLE:
throw new Exception($auth['response']->get('message'));
break;case Auth::UNEXPECTED:
print_r($auth);
throw new Exception('Unexpected error 1');
break;
case Auth::BAD_CREDENTIALS:
cli()->lightRed()->out($auth['response']->get('message'));
$input = cli()->confirm('Want to enter new credentials?');
if (!$input->confirmed()) {
cli()->lightRed()->out('Client has been stopped.');
exit;
}
$username = cli()->input('>>> Enter username:')->prompt();
$password = cli()->password('>>> Enter password:')->prompt();
$client->setUsername($username);
$client->setPassword($password);
$auth = $client->auth();
break;
default:
throw new Exception("Unexpected error 2");
break;
}
}
}/** We are now logged in */
$balance = $client->market()->getBalance();
print_r($balance);/** Output */
Array
(
[raw] => 13,37 pуб.
[clean] => 13.37
)
``````bash
php steam.php
```