https://github.com/hyperplural/warface-sdk
Fast and flexible SDK client of the Warface API in PHP.
https://github.com/hyperplural/warface-sdk
api php sdk warface warface-api
Last synced: 3 months ago
JSON representation
Fast and flexible SDK client of the Warface API in PHP.
- Host: GitHub
- URL: https://github.com/hyperplural/warface-sdk
- Owner: hyperplural
- License: mit
- Created: 2020-07-04T14:38:51.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-05-17T08:25:36.000Z (about 1 year ago)
- Last Synced: 2025-06-09T09:43:54.268Z (about 1 year ago)
- Topics: api, php, sdk, warface, warface-api
- Language: PHP
- Homepage:
- Size: 175 KB
- Stars: 13
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Warface SDK (PHP)

Fast, PSR‑18 HTTP‑client agnostic SDK for the public Warface API. Requires PHP >= 8.1.
## Installation
```bash
composer require hyperplural/warface-sdk guzzlehttp/guzzle:^7 http-interop/http-factory-guzzle:^1
```
Decoupled from any specific HTTP client via [HTTPlug](https://httplug.io/).
## Quickstart
```php
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):
```php
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
```bash
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.