PHPackages                             jarkt/docker-php-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. jarkt/docker-php-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

jarkt/docker-php-client
=======================

1.0.5(8y ago)71.9k2[1 issues](https://github.com/jarkt/docker-php-client/issues)PHP

Since Feb 8Pushed 8y ago2 watchersCompare

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

READMEChangelogDependencies (1)Versions (12)Used By (0)

Usage
=====

[](#usage)

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

[](#installation)

Install via composer:

```
{
	"require": {
		"jarkt/docker-php-client": "1.0.*"
	}
}
```

Usage
-----

[](#usage-1)

The ApiClient connects to the [Docker Remote API](https://docs.docker.com/engine/reference/api/docker_remote_api/) via HTTP. You can use the container ["jarkt/docker-remote-api"](https://hub.docker.com/r/jarkt/docker-remote-api/) to make the API available.

First create an instance of the ApiClient.

```
\jarkt\docker\ApiClient::construct ($host, $port [, $version ] )

```

Example:

```
$docker = new ApiClient(getenv('API_PORT_2375_TCP_ADDR'), getenv('API_PORT_2375_TCP_PORT'), 'v1.21');
```

(Haha, like 1.21 Gigawatt :-)

You can use various types of request methods to perform your API call. There are get, head, delete, post and put. The signatures are the same:

```
method ($path [, array $params [, requestHandlers\RequestHandler $requestHandler ]] )

```

For your call you have to serve the request path and optional an array of request parameters. Some requests require data in the request body - for these you can also give an instance of an implementation of a requestHandlers\\RequestHandler. These implementation prepares a certain data type for the http api request.

Here are some examples:

```
$response = $docker->get('/containers/json');
```

```
$response = $docker->head('/containers/4fa6e0f0c678/archive', ['path' => '/path/on/container']);
```

```
$response = $docker->post('/containers/create', [], new requestHandlers\Json(['Image' => '4fa6e0f0c678']));
```

```
$response = $docker->put(
	'/containers/4fa6e0f0c678/archive',
	['path' => '/path/on/container'],
	new requestHandlers\Files('/path/on/local/machine')
);
```

From the response you can get the status code, to decide what type of ResponseHandler you need. Use a responseHandler\\ResponseHandler to get informations from the response or to start actions on the local machine like unpacking a tar archive.

Here are some examples:

```
$response = $docker->get('/containers/json');
if($response->getStatus() === 200) {
	$responseHandler = new responseHandlers\Json($response);
	$containers = $responseHandler->getData();
	var_dump($containers);
}
```

```
$response = $docker->get('/containers/4fa6e0f0c678/archive', ['path' => '/path/on/container']);
if($response->getStatus() === 200) {
	$responseHandler = new responseHandlers\Files($response);
	$stat = json_decode(base64_decode($responseHandler->getHeader('x-docker-container-path-stat')), true);
	var_dump($stat);
	$responseHandler->extract('/path/on/local/machine');
}
```

Hint
----

[](#hint)

Use the environment variable HOSTNAME as the container id of your own host.

Developers
==========

[](#developers)

Tests are running inside a docker container. Install all the test dependencies by going to the "containers" folder and type: `./install.sh`

Update dependencies with: `./update.sh`

Run the tests with: `./test.sh`

This will make the API available through the container ["jarkt/docker-remote-api"](https://github.com/jarkt/docker-remote-api) and run the tests against this endpoint.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity70

Established project with proven stability

 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 ~85 days

Recently: every ~48 days

Total

11

Last Release

2939d ago

Major Versions

0.9.4 → 1.0.02017-11-23

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2691295?v=4)[Jark Tonnätt](/maintainers/jarkt)[@jarkt](https://github.com/jarkt)

---

Top Contributors

[![jarkt](https://avatars.githubusercontent.com/u/2691295?v=4)](https://github.com/jarkt "jarkt (14 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25025.5M80](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.2M6.6k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k20.0k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87930.4k113](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69122.6k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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