PHP code example of seatplus / eveapi

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

    

seatplus / eveapi example snippets


final class CharacterInfoJob extends EsiJob
{
    protected const string OPERATION_CLASS = GetCharactersCharacterId::class;

    public function __construct(public int $character_id) {}

    public function tags(): array
    {
        return ['character', 'info', "character_id:{$this->character_id}"];
    }

    public function executeJob(EsiClient $esi): void
    {
        $response = self::OPERATION_CLASS::execute($esi, $this->character_id);

        if ($response->isCachedLoad) {
            return;
        }

        CharacterInfo::updateOrCreate(
            ['character_id' => $this->character_id],
            ['name' => $response->name, ...],
        );
    }
}

public function getRefreshToken(): RefreshToken
{
    return RefreshToken::findOrFail($this->character_id);
}

$page = 1;
do {
    $response = self::OPERATION_CLASS::execute($esi, $this->character_id, $page);
    if ($response->isCachedLoad) { return; }
    // ... collect $response->data ...
    $page++;
} while ($page <= $response->pages);
bash
php artisan migrate