A Docker Engine API client for Laravel with a built-in Livewire management UI.
Connect to your Docker daemon via Unix socket, TCP, or TLS. Use the fluent API in code or the included UI to manage containers, images, networks, volumes, and Swarm.
Resources cover containers, images, networks, volumes, Swarm, services, nodes, tasks, secrets, configs, plugins, builds, exec, and distribution. The default API version is v1.53.
The included dashboard and management screens use Flux UI and support dark mode. The UI is served at /docker by default and can be disabled or moved with configuration.
Watch image pulls with live progress bars powered by Server-Sent Events. Stream container logs and stats with multiplexed stream decoding built in.
First-class Data Transfer Objects for list and inspect responses — ImageSummary, ContainerSummary, SystemInfo, DiskUsage, and more — so you never work with raw arrays.
Saloon cache plugin for read-only requests (info, version, image inspect/history) with configurable TTLs. Keep things fast without stale data.
Connect via Unix socket (default), TCP, or TLS with full certificate support. Configurable timeouts and custom headers out of the box.
Initialize, join, and leave clusters. Manage services, nodes, tasks, secrets, and configs from the UI or programmatically through the API.
Pest feature and unit tests use Saloon's MockClient, so they run without a Docker daemon. Lawman checks the connector and request architecture.
- PHP 8.3 or newer
- Laravel 12
- Livewire 4 and Flux 2
- A Docker Engine daemon for real API operations; a daemon is not needed to install the package or run its mocked tests
1. Install
composer require eloquage/docker-php2. Publish config
php artisan vendor:publish --tag=docker-php.config3. Configure (default: Unix socket)
DOCKER_CONNECTION=unix
DOCKER_UNIX_SOCKET=/var/run/docker.sock
DOCKER_API_VERSION=v1.534. Open the UI at /docker (or your configured prefix).
use Eloquage\DockerPhp\Facades\DockerPhp;
// List containers
$response = DockerPhp::containers()->list(all: true);
$containers = $response->json();
// List images (returns DTOs)
$response = DockerPhp::images()->list();
$images = $response->dto(); // ImageSummary[]
// System info
$response = DockerPhp::system()->info();
$info = $response->dto(); // SystemInfo
$hostname = $info->name();Errors are thrown as Eloquage\DockerPhp\Exceptions\DockerApiException with the daemon’s message.
| Env / config | Default | Description |
|---|---|---|
DOCKER_CONNECTION |
unix |
unix, tcp, or tls |
DOCKER_UNIX_SOCKET |
/var/run/docker.sock |
Socket path (unix) |
DOCKER_HOST |
localhost |
Host (tcp/tls) |
DOCKER_PORT |
2375 |
Port (tcp/tls) |
DOCKER_API_VERSION |
v1.53 |
Engine API version |
DOCKER_PHP_UI_PREFIX |
docker |
URL prefix for the UI |
DOCKER_PHP_CACHE_ENABLED |
true |
Cache for read-only requests |
See config/docker-php.php and the documentation for the full reference.
The UI includes a sidebar with Dashboard, Containers, Images, Volumes, Networks, and (when Swarm is initialized) Swarm, Services, Nodes, Tasks, Secrets, and Configs. The dashboard loads system info, version, and disk usage in parallel. Images support pull with progress bar (SSE), Docker Hub search, tag, inspect with history, and prune with feedback.
vendor/bin/pest --compactTests use Saloon’s MockClient; no Docker daemon is required. See Testing in the docs.
Livewire components use the same DockerPhp service and resources to drive the UI.
Full documentation (getting started, configuration, API reference, UI guide, caching, streaming, testing) is published at:
https://eloquage.github.io/docker-php
See changelog.md for what has changed recently.
See contributing.md for details.
If you discover any security-related issues, please email the maintainers instead of using the issue tracker.
MIT. See the license file for more information.
