PHP code example of velkuns / artifactsmmo-client

1. Go to this page and download the library: Download velkuns/artifactsmmo-client 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/ */

    

velkuns / artifactsmmo-client example snippets




declare(strict_types=1);

namespace Application;

use Eureka\Component\Curl\HttpClient;
use Nyholm\Psr7\Factory\Psr17Factory;
use Psr\Log\NullLogger;
use Velkuns\ArtifactsMMO\Client\Client;
use Velkuns\ArtifactsMMO\Client\MyClient;
use Velkuns\ArtifactsMMO\Config\ArtifactsMMOConfig;
use Velkuns\ArtifactsMMO\Request\RequestBuilder;
use Velkuns\ArtifactsMMO\VO\Body\BodyCrafting;
use Velkuns\ArtifactsMMO\VO\Body\BodyDestination;

Client($httpClient, $logger, $requestBuilder);


//~ Call endpoint and get Value Object with response data
$status = $client->getStatus(); // Get status (VO\Status);

echo "Server is $status->status\n";
echo "Number of characters online: $status->charactersOnline\n";

//~ Move a character
$myClient = new MyClient($httpClient, $logger, $requestBuilder);
$myClient->actionMove('character_name', new BodyDestination(1, 1));

//~ Crafting an item
$myClient->actionCrafting('character_name', new BodyCrafting('wooden_staff', 1));
bash
make php-min-compatibility
bash
make php-max-compatibility