PHP code example of hypertensy / warface-sdk

1. Go to this page and download the library: Download hypertensy/warface-sdk 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/ */

    

hypertensy / warface-sdk example snippets


public function __construct(
    \Wnull\Warface\HttpClient\ClientBuilder $httpClientBuilder = null, 
    \Wnull\Warface\Enum\RegionEnum $region = null,
): \Wnull\Warface\Client

$client = new \Wnull\Warface\Client();

$builder = (new \Wnull\Warface\HttpClient\ClientBuilder());
$builder->addPlugin(
    new class implements \Http\Client\Common\Plugin {
        public function handleRequest(
            \Psr\Http\Message\RequestInterface $request, 
            callable $next, 
            callable $first
        ): \Http\Promise\Promise {
            // TODO: Implement handleRequest() method.
        }
    }
);

$client = new \Wnull\Warface\Client($builder);

$builder = null; // builder or null
$client = new \Wnull\Warface\Client($builder, \Wnull\Warface\Enum\RegionEnum::INTERNATIONAL());

$client = \Wnull\Warface\Client::createWithHttpClient(
    new \Symfony\Component\HttpClient\HttplugClient()
);

  $catalog = (new \Wnull\Warface\Client())->achievement()->catalog();
  

  $members = (new \Wnull\Warface\Client())->clan()->members('<clan>');
  

  $missions = (new \Wnull\Warface\Client())->game()->missions();
  

  $monthly = (new \Wnull\Warface\Client())
    ->rating()
    ->monthly('?<clan>', \Wnull\Warface\Enum\RatingLeague::ELITE(), '?<page>');
  

  $clan = (new \Wnull\Warface\Client())->rating()->clan();
  

  $top100 = (new \Wnull\Warface\Client())->rating()->top100(\Wnull\Warface\Enum\GameClass::MEDIC());
  

  $stat = (new \Wnull\Warface\Client())->user()->stat('<name>');
  

  $achievements = (new \Wnull\Warface\Client())->user()->achievements('<name>');
  

  $catalog = (new \Wnull\Warface\Client())->achievement()->catalog();