1. Go to this page and download the library: Download seatplus/esi-schema 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 / esi-schema example snippets
use Seatplus\EsiSchema\Resources\Assets\GetCharactersCharacterIdAssets;
use Seatplus\EsiSchema\Resources\Market\GetMarketsPrices;
// 1. Pre-call introspection — no transport needed
$meta = GetCharactersCharacterIdAssets::meta();
$meta->Cursor; // false
// Or access constants directly — no allocation at all
GetCharactersCharacterIdAssets::REQUIRED_SCOPE; // 'esi-assets.read_assets.v1'
GetCharactersCharacterIdAssets::RATE_LIMIT_GROUP; // 'char-asset'
GetCharactersCharacterIdAssets::RATE_LIMIT_MAX_TOKENS; // 1800
GetCharactersCharacterIdAssets::CACHE_AGE; // 3600
// Check a token before dispatching a job
if ($meta->
use Seatplus\EsiSchema\Resources\AssetsResource;
use Seatplus\EsiSchema\Resources\CharacterResource;
// Construct with any EsiTransportInterface
$assets = new AssetsResource($transport);
$characters = new CharacterResource($transport);
// Same parameters, same return types as the static API
$result = $assets->getCharactersCharacterIdAssets(characterId: 12345, page: 1);
$dto = $characters->getCharactersCharacterId(characterId: 12345);
// With esi-client (EsiClient implements EsiTransportInterface):
$result = $esiClient->withToken($accessToken)->assets()->getCharactersCharacterIdAssets(12345, page: 1);
use Seatplus\EsiSchema\Resources\Assets\GetCharactersCharacterIdAssets;
class CharacterAssetJob extends EsiJob
{
public function __construct(
public readonly int $characterId,
public readonly RefreshToken $token,
) {}
// EsiJob base reads this to get scope, rate-limit group, etc.
protected const string OPERATION = GetCharactersCharacterIdAssets::class;
protected function executeJob(EsiTransportInterface $transport): void
{
$result = GetCharactersCharacterIdAssets::execute(
$transport, $this->characterId
);
if ($result->isCachedLoad) return;
Asset::upsert(/* ... */);
}
}
use Seatplus\EsiSchema\Contracts\EsiTransportInterface;
use Seatplus\EsiSchema\Contracts\EsiRawResponse;
class MyTransport implements EsiTransportInterface
{
public function invoke(
string $method,
string $path,
array $pathValues = [],
array $queryParams = [],
array $requestBody = [],
): EsiRawResponse {
// ... perform the HTTP request, handle caching, auth etc.
return new EsiRawResponse(
data: $responseBody, // decoded JSON (mixed)
isCachedLoad: $wasCached, // bool
pages: $xPagesHeader ?? 1, // int
rateLimitRemaining: $remaining,
rateLimitUsed: $used,
retryAfter: $retryAfter, // null unless 429
);
}
}
public const ?string REQUIRED_SCOPE = 'esi-assets.read_assets.v1';
public const ?string RATE_LIMIT_GROUP = 'char-asset';
public const ?int RATE_LIMIT_MAX_TOKENS = 1800;
public const ?string RATE_LIMIT_WINDOW = '15m';
public const ?int CACHE_AGE = 3600;
public const array REQUIRED_ROLES = [];
public const bool USES_CURSOR = false;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.