PHP code example of ins0 / armasquads-api-restclient

1. Go to this page and download the library: Download ins0/armasquads-api-restclient 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/ */

    

ins0 / armasquads-api-restclient example snippets


    $auth   = new \ArmAsquads\Api\Authentication\HttpHeader('YOUR_API_KEY');
    $api    = new \ArmAsquads\Api($auth);

    Try {
        $squads = $api->getSquads();

        foreach($squads as $squad)
        {
            echo $squad->getName() . "\r\n";
        }
    } Catch(\ArmAsquads\Api\Exception $e)
    {
        echo $e->getMessage() . PHP_EOL;
        echo $api->getLastResponseStatusCode() . PHP_EOL;
        
        print_r($api->getResponseErrorMessages());
    }