PHPackages                             exodus4d/pathfinder\_esi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. exodus4d/pathfinder\_esi

ActiveLibrary

exodus4d/pathfinder\_esi
========================

ESI API library for Pathfinder

v2.0.1(6y ago)23.9k14[3 PRs](https://github.com/exodus4d/pathfinder_esi/pulls)MITPHP

Since Apr 29Pushed 4y ago3 watchersCompare

[ Source](https://github.com/exodus4d/pathfinder_esi)[ Packagist](https://packagist.org/packages/exodus4d/pathfinder_esi)[ Docs](https://github.com/exodus4d/pathfinder_esi)[ RSS](/packages/exodus4d-pathfinder-esi/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (4)Versions (15)Used By (0)

Web API client for [*EVE-Online*](https://www.eveonline.com) - [*ESI* API](https://esi.evetech.net)
---------------------------------------------------------------------------------------------------

[](#web-api-client-for-eve-online---esi-api)

This Web API client library is used by [*Pathfinder*](https://github.com/exodus4d/pathfinder) and handles all *ESI* API requests.
Additional APIs can easily be added and can be used side by side with their own configuration. Included clients:

- *CCP ESI* API client: [Esi.php](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Client/Ccp/Esi/Esi.php)
- *CCP SSO* API client: [Sso.php](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Client/Ccp/Sso/Sso.php)
- *GitHub* basic API client: [GitHub.php](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Client/GitHub/GitHub.php)
- *eve-scout* *"Thera"* API client: [EveScout.php](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Client/EveScout/EveScout.php)

This Web client is build on [*Guzzle*](http://guzzlephp.org) and makes much use of the build in [*Middleware*](http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html#middleware) concept in *Guzzle*.

### Installation:

[](#installation)

Use [*Composer*](https://getcomposer.org/) for installation. In `composer.json` `require` section add:

```
{
  "require": {
    "php-64bit": ">=7.2",
    "exodus4d/pathfinder_esi": "v2.0.0"
  }
}
```

> ***Pathfinder*:** This web API client lib is automatically installed through [*Composer*](https://getcomposer.org/) along with all other required dependencies for the *Pathfinder* project. (→ see [composer.json](https://github.com/exodus4d/pathfinder/blob/master/composer.json)).
>
> A newer version of *Pathfinder* **may** require a newer version of this repository as well. So running `composer install` **after** a *Pathfinder* update will upgrade/install a newer *ESI* client. Check *Pathfinder* [release](https://github.com/exodus4d/pathfinder/releases) notes for further information.

### Use Client:

[](#use-client)

#### 1. Init client:

[](#1-init-client)

```
// New web client instance for GitHub API [→ Github() implements ApiInterface()]
$client = new \Exodus4D\ESI\Client\GitHub\GitHub('https://api.github.com');

// configure client [→ check ApiInterface() for methods]
$client->setTimeout(3);                     // Timeout of the request (seconds)
$client->setUserAgent('My Example App');    // User-Agent Header (string)
$client->setDecodeContent('gzip, deflate'); // Accept-Encoding Header
$client->setDebugLevel(3);                  // Debug level [0-3]
$client->setNewLog(function() : \Closure {  // Callback for new LogInterface
   return function(string $action, string $level = 'warning') : logging\LogInterface {
       $log = new logging\ApiLog($action, $level);
       $log->addHandler('stream', 'json', './logs/requests.log');
       return $log;
   };
});

// Loggable $requests (e.g. HTTP 5xx resp.) will not get logged if return false;
$client->setIsLoggable(function() : \Closure {
    return function(RequestInterface $request) use ($f3) : bool {
        return true;
    };
});

$client->setLogStats(true);                 // add some cURL status information (e.g. transferTime) to logged responses

$client->setLogCache(true);                 // add (local) cache info (e.g. response data cached) to logged requests
$client->setLogAllStatus(false);            // log all requests regardless of response HTTP status code
$client->setLogRequestHeaders(false);       // add request HTTP headers to loggable requests
$client->setLogResponseHeaders(false);      // add response HTTP headers to loggable requests
$client->setLogFile('requests');            // log file name for request/response errors
$client->setRetryLogFile('retry_requests'); // log file for requests errors due to max request retry exceeds

$client->setCacheDebug(true);               // add debug HTTP Header with local cache status information (HIT/MISS)
$client->setCachePool(function() : \Closure {
    return function() : ?CacheItemPoolInterface {
        $client = new \Redis();             // Cache backend used accross the web client
        $client->connect('localhost', 6379);

        // → more PSR-6 compatible adapters at www.php-cache.com (e.g. Filesystem, Array,…)
        $poolRedis = new RedisCachePool($client);
        $cachePool = new NamespacedCachePool($poolRedis, 'myCachePoolName');
        return $cachePool;                  // This can be any PSR-6 compatible instance of CacheItemPoolInterface()
    };
});
```

#### 2. Send requests

[](#2-send-requests)

```
// get all releases from GitHub for a repo
$releases = $client->send('getProjectReleases', 'exodus4d/pathfinder');
// … more requests here
```

Concept
-------

[](#concept)

### *Guzzle* [*Middlewares*](http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html#middleware) :

[](#guzzle-middlewares-)

*Middlewares* classes are *small* functions that *hook* into the "request → response" chain in *Guzzle*.

- A *Middleware* can *manipulate* the `request` and `response` objects
- Each *Middleware* is dedicated to handles its own task.
- There are *Middlewares* for "logging", "caching",… pre-configured.
- Each *Middleware* has its own set of config options that can be set through the `$client->`.
- All configured *Middlewares* are pushed into a [*HandlerStack()*](http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html#handlerstack) that gets *resolved* for **each** request.
- The **order** in the `HandlerStack()` is essential!

### *Guzzle* [*HandlerStack*](http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html#handlerstack) :

[](#guzzle-handlerstack-)

This flowchart shows all *Middlewares* used by [ESI.php](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Client/Ccp/Esi/Esi.php) API client. Each request to *ESI* API invokes all *Middlewares* in the following **order**:

##### Before request

[](#before-request)

[GuzzleJsonMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleJsonMiddleware.php) → [GuzzleLogMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleLogMiddleware.php) → [GuzzleCacheMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleCacheMiddleware.php) → [GuzzleCcpLogMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleCcpLogMiddleware.php) → [GuzzleRetryMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleRetryMiddleware.php) → [GuzzleCcpErrorLimitMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleCcpErrorLimitMiddleware.php)

##### After response (→ reverse order!)

[](#after-response--reverse-order)

[GuzzleCcpErrorLimitMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleCcpErrorLimitMiddleware.php) → [GuzzleRetryMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleRetryMiddleware.php) → [GuzzleCcpLogMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleCcpLogMiddleware.php) → [GuzzleCacheMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleCacheMiddleware.php) → [GuzzleLogMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleLogMiddleware.php) → [GuzzleJsonMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleJsonMiddleware.php)

### Default *Middlewares*:

[](#default-middlewares)

#### JSON

[](#json)

Requests with expected *JSON* encoded `response` data have [GuzzleJsonMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleJsonMiddleware.php)in *HandlerStack*.
This adds `Accept: application/json` Header to `request` and `response` body gets *wrapped* into [JsonStream](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Stream/JsonStream.php).

`$client->setAcceptType('json');`

#### Caching

[](#caching)

A client instance *should* be set up with a [*PSR-6*](https://www.php-fig.org/psr/psr-6) compatible cache pool where *persistent* data can be stored. Valid `response` data can be cached by its `Cache-Expire` HTTP Header. [GuzzleCacheMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleCacheMiddleware.php) also handle `Etag` Headers. Other *Middlewares* can also access the cache pool for their needs. E.g. [GuzzleLogMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleLogMiddleware.php) can *throttle* error logging by using the cache pool for error counts,…

→ See: `$client->setCachePool();`

> **Hint:** Check out [www.php-cache.com](http://www.php-cache.com) for *PSR-6* compatible cache pools.

#### Logging

[](#logging)

Errors (or other *events*) during (~before) a request can be logged (e.g. connect errors, or 4xx/5xx `responses`).
The *primary* *Middleware* for logging is [GuzzleLogMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleLogMiddleware.php)
Other *Middlewares* also have access to the *global* new log callback and implement their own logs.

`$client->setNewLog();`

#### Retry

[](#retry)

Requests result in an *expected* error (timeouts, *cURL* connect errors,… ) will be retried \[default: 2 times → configurable!\]. Check out [GuzzleRetryMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleRetryMiddleware.php) for more information.

### *CCP ESI* exclusive *Middlewares*:

[](#ccp-esi-exclusive-middlewares)

Each web client has its own stack of *Middlewares*. These *Middlewares* are exclusive for `requests` to *CCP´s ESI* API:

#### [GuzzleCcpLogMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleCcpLogMiddleware.php)

[](#guzzleccplogmiddleware)

Requests to endpoints that return a `warning` HTTP Header for `deprecated` /or `legacy` marked endpoints get logged into separate log files.

#### [GuzzleCcpErrorLimitMiddleware](https://github.com/exodus4d/pathfinder_esi/blob/master/app/Lib/Middleware/GuzzleCcpErrorLimitMiddleware.php)

[](#guzzleccperrorlimitmiddleware)

Failed *ESI* requests (4xx/5xx status code) implement the concept of "Error Rate Limiting" (→ blog: [ESI error rate limiting](https://developers.eveonline.com/blog/article/esi-error-limits-go-live)). In case a request failed multiple times in a period, this *Middleware* keeps track of logging this **and** *pre-block* requests (e.g. for a user) an endpoint before *CCP* actual does.

### Content Encoding

[](#content-encoding)

The default configuration for "[decode-content](http://docs.guzzlephp.org/en/stable/request-options.html#decode-content)" is `true` → decode "*gzip*" or "*deflate*" responses.
Most APIs will only send compressed response data if `Accept-Encoding` HTTP Header found in request. A `string` value will add this Header and response data gets decoded.

`$client->setDecodeContent('gzip, deflate');`

Bug report
----------

[](#bug-report)

Issues can be tracked here:

Development
-----------

[](#development)

If you are a developer you might have **both** repositories ([exodus4d/pathfinder](https://github.com/exodus4d/pathfinder), [exodus4d/pathfinder\_esi](https://github.com/exodus4d/pathfinder_esi) ) checked out locally.

In this case you probably want to *test* changes in your **local** [exodus4d/pathfinder\_esi](https://github.com/exodus4d/pathfinder_esi) repo using your **local** [exodus4d/pathfinder](https://github.com/exodus4d/pathfinder) installation.

1. Clone/Checkout **both** repositories local next to each other
2. Make your changes in your pathfinder\_esi repo and **commit** changes (no push!)
3. Switch to your pathfinder repo
4. Run *Composer* with [`composer-dev.json`](https://github.com/exodus4d/pathfinder/blob/master/composer-dev.json), which installs pathfinder\_esi from your **local** repository.
    - Unix: `$set COMPOSER=composer-dev.json && composer update`
    - Windows (PowerShell): `$env:COMPOSER="composer-dev.json"; composer update --no-suggest`

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 99.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~88 days

Recently: every ~101 days

Total

13

Last Release

2239d ago

Major Versions

v1.3.2 → v2.0.02020-03-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9299033?v=4)[Mark Friedrich](/maintainers/exodus4d)[@exodus4d](https://github.com/exodus4d)

---

Top Contributors

[![exodus4d](https://avatars.githubusercontent.com/u/9299033?v=4)](https://github.com/exodus4d "exodus4d (613 commits)")[![Kill4Free](https://avatars.githubusercontent.com/u/2834039?v=4)](https://github.com/Kill4Free "Kill4Free (1 commits)")

### Embed Badge

![Health badge](/badges/exodus4d-pathfinder-esi/health.svg)

```
[![Health](https://phpackages.com/badges/exodus4d-pathfinder-esi/health.svg)](https://phpackages.com/packages/exodus4d-pathfinder-esi)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k20](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[moe-mizrak/laravel-openrouter

Laravel package for OpenRouter (A unified interface for LLMs)

153107.2k2](/packages/moe-mizrak-laravel-openrouter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
