PHPackages                             prsw/docker-php - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. prsw/docker-php

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

prsw/docker-php
===============

Docker PHP SDK

v0.3.0(1mo ago)05MITPHPPHP ~8.3.0 || ~8.4.0 || ~8.5.0

Since Dec 31Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/praswicaksono/docker-php)[ Packagist](https://packagist.org/packages/prsw/docker-php)[ RSS](/packages/prsw-docker-php/feed)WikiDiscussions master Synced today

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

Docker PHP SDK
==============

[](#docker-php-sdk)

Asynchronous Docker Engine API client for PHP, built on [amphp](https://amphp.org/) and generated from the official [OpenAPI specification](v1.47.yaml).

This is a rewrite of [docker-php/docker-php](https://github.com/docker-php/docker-php).

**CAUTION** Not all endpoints have streaming support implemented.

Requirements
------------

[](#requirements)

- PHP 8.3+
- Docker Engine (Unix socket access)

Installation
------------

[](#installation)

```
composer require prsw/docker-php
```

Quick Start
-----------

[](#quick-start)

```
use PRSW\Docker\Client;

// Connect to the default Docker Unix socket
$client = Client::withHttpClient();

// List all containers
$containers = $client->containerList();
var_dump($containers);
```

Usage
-----

[](#usage)

### Basic Operations

[](#basic-operations)

```
use PRSW\Docker\Client;

$client = Client::withHttpClient();

// Inspect a container
$info = $client->containerInspect('container_id');

// Start/stop a container
$client->containerStart('container_id');
$client->containerStop('container_id');

// List images
$images = $client->imageList();
```

### Streaming Events

[](#streaming-events)

Stream real-time Docker events using `FETCH_STREAM`:

```
use PRSW\Docker\Client;

\Amp\async(function () {
    $client = Client::withHttpClient();

    $response = $client->systemEvents(fetch: Client::FETCH_STREAM);

    foreach ($response->getBody() as $event) {
        var_dump($event);
    }
})->await();
```

### Container Logs

[](#container-logs)

```
use PRSW\Docker\Client;

$client = Client::withHttpClient();

$logs = $client->containerLogs('container_id', [
    'stdout' => true,
    'stderr' => true,
    'since'  => (new \DateTime('-7 days'))->getTimestamp(),
]);

foreach ($logs->getBody() as $line) {
    var_dump($line);
}
```

### Service Logs

[](#service-logs)

```
use PRSW\Docker\Client;

$client = Client::withHttpClient();

$logs = $client->serviceLogs('service_id', [
    'stdout' => true,
    'stderr' => true,
]);

foreach ($logs->getBody() as $line) {
    var_dump($line);
}
```

### Custom Socket Path

[](#custom-socket-path)

```
$client = Client::withHttpClient(socketPath: '/path/to/docker.sock');
```

### Custom Client Options

[](#custom-client-options)

```
$client = Client::withHttpClient(
    socketPath: '/var/run/docker.sock',
    options: [
        'timeout' => 30,    // request timeout in seconds (-1 for no timeout)
        'retry'   => 3,     // number of retries on failure
    ],
);
```

You can also create a new client instance with different options using:

```
$client = $client->withHttpClientOptions(['timeout' => 60, 'retry' => 5]);
```

API Version
-----------

[](#api-version)

This SDK targets the Docker Engine API **v1.47** (Docker 27.x+). The OpenAPI specification is at [v1.47.yaml](v1.47.yaml).

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance89

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~165 days

Total

4

Last Release

55d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/023a0bd17758df473ae6dad9f07575a8d0a8c36b06e83396b5962aecba38c722?d=identicon)[PrasWicaksono](/maintainers/PrasWicaksono)

---

Top Contributors

[![praswicaksono](https://avatars.githubusercontent.com/u/603125?v=4)](https://github.com/praswicaksono "praswicaksono (5 commits)")

---

Tags

asyncdocker-clientphp

### Embed Badge

![Health badge](/badges/prsw-docker-php/health.svg)

```
[![Health](https://phpackages.com/badges/prsw-docker-php/health.svg)](https://phpackages.com/packages/prsw-docker-php)
```

###  Alternatives

[laravel/octane

Supercharge your Laravel application's performance.

4.0k26.6M223](/packages/laravel-octane)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

5.1k5.2k](/packages/shlinkio-shlink)[cakephp/authentication

Authentication plugin for CakePHP

1214.1M106](/packages/cakephp-authentication)[putyourlightson/craft-blitz

Intelligent static page caching for creating lightning-fast sites.

155484.7k37](/packages/putyourlightson-craft-blitz)

PHPackages © 2026

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