API reference

The package uses Saloon for HTTP: a connector sends requests and returns responses. Responses can be turned into DTOs when the request defines createDtoFromResponse. Errors are thrown as DockerApiException.

flowchart LR
  Facade[DockerPhp facade]
  Service[DockerPhp service]
  Res[Resources]
  Req[Requests]
  Conn[DockerConnector]
  Engine[Docker Engine]
  Facade --> Service
  Service --> Res
  Res --> Req
  Req --> Conn
  Conn --> Engine
  • Connector — Connection modes, timeouts, TLS, error handling
  • Resources — All 17 resources and their methods
  • Requests — Request classes by category (100+ endpoints)
  • DTOs — Data Transfer Objects for typed responses
  • Exceptions — DockerApiException and AlwaysThrowOnErrors

Quick example

use Eloquage\DockerPhp\Facades\DockerPhp;

$response = DockerPhp::containers()->list(all: true);
$containers = $response->json();

$response = DockerPhp::images()->list();
$summaries = $response->dto(); // ImageSummary[]

$response = DockerPhp::system()->info();
$info = $response->dto(); // SystemInfo

Table of contents