hyperplural / warface-sdk
Fast and flexible SDK client of the Warface API in PHP.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 3
Forks: 3
Open Issues: 0
pkg:composer/hyperplural/warface-sdk
Requires
- php: >=8.1
- ext-json: *
- fig/http-message-util: ^1.1
- php-http/client-common: ^2.0
- php-http/discovery: ^1.13
- php-http/httplug: ^2.0
- php-http/message: ^1.0
- psr/http-client-implementation: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.5
- guzzlehttp/psr7: ^2.6
- php-http/guzzle7-adapter: ^1.0
- php-http/mock-client: ^1.5
- phpstan/phpstan: ^1.8.6
- phpunit/phpunit: ^10.5
- rector/rector: ^1.2
- squizlabs/php_codesniffer: ^3.9
README
Fast, PSR‑18 HTTP‑client agnostic SDK for the public Warface API. Requires PHP >= 8.1.
Installation
composer require hyperplural/warface-sdk guzzlehttp/guzzle:^7 http-interop/http-factory-guzzle:^1
Decoupled from any specific HTTP client via HTTPlug.
Quickstart
use Hyperplural\WarfaceSdk\Client; use Hyperplural\WarfaceSdk\Enum\RatingLeague; use Hyperplural\WarfaceSdk\Enum\GameClass; $client = new Client(); // Player stats $stat = $client->user()->stat('Nickname'); // Player achievements $achievements = $client->user()->achievements('Nickname'); // Achievement catalog $catalog = $client->achievement()->catalog(); // Clan info $clan = $client->clan()->members('ClanName'); // Missions $missions = $client->game()->missions(); // Ratings $monthly = $client->rating()->monthly('', RatingLeague::ELITE); $top100 = $client->rating()->top100(GameClass::MEDIC);
Custom HTTP client
Provide your own PSR‑18 client (e.g., Symfony HttpClient with HTTPlug adapter):
use Hyperplural\WarfaceSdk\Client; use Symfony\Component\HttpClient\HttplugClient; $client = Client::createWithHttpClient(new HttplugClient());
References
- Official docs: https://ru.warface.com/wiki/index.php/API
- WFTS (legacy application) as an additional reference source.
Testing
composer test
Unit tests rely on JSON fixtures and a mock HTTP client — no network required. CI enforces 100% line coverage.
License
MIT. See LICENSE for details.