PHP code example of kehet / artifactsmmo-client

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

    

kehet / artifactsmmo-client example snippets




\Kehet\ArtifactsMMO\Configuration::getDefaultConfiguration()
    ->setHost('https://api.artifactsmmo.com')
    ->setAccessToken('XXXXXXXXXXXXXX');

$apiInstance = new \Kehet\ArtifactsMMO\Api\MyCharactersApi(
    new \GuzzleHttp\Client()
);

try {
    $response = $apiInstance->actionMoveMyNameActionMovePost(
        'Kehetus',
        new \Kehet\ArtifactsMMO\Model\DestinationSchema([
            'x' => 1,
            'y' => 1,
        ])
    );
    
    print_r($result);
} catch (\Kehet\ArtifactsMMO\ApiException $e) {
    echo 'Exception when calling AccountsApi->createAccountAccountsCreatePost: ', $e->getMessage(), PHP_EOL;
}



$config = new \Kehet\ArtifactsMMO\Configuration()
    ->setHost('https://api.artifactsmmo.com')
    ->setAccessToken('XXXXXXXXXXXXXX');

$api = new \Kehet\ArtifactsMMO\Api\ItemsApi(new GuzzleHttp\Client(), $config);

$items = iterator_to_array(\Kehet\ArtifactsMMO\Util\Unpaginate::iterate(
    fn(int $page) => $api->getAllItemsItemsGet(page: $page, size: 100),
    sleepSeconds: 1
));

var_dump($items);
var_dump(count($items));