@@ -11,7 +11,7 @@ This library aims to reach 100% API support of the Docker Engine.
1111
1212## Documentation
1313
14- The [ version 3 .x documentation] ( https://docker-php.mintlify.site/ ) is available.
14+ The [ version 4 .x documentation] ( https://docker-php.mintlify.site/ ) is available.
1515Its source lives in
1616[ docs/] ( docs/ ) ; see [ DOCUMENTATION.md] ( DOCUMENTATION.md ) to preview and edit it
1717locally. The [ legacy documentation] ( https://docker-php.readthedocs.io/en/latest/ )
@@ -28,25 +28,24 @@ maintenance of the original `docker-php/docker-php` repository to give you a
2828better upgrade path. Development will continue here, and we will archive
2929` beluga-php/docker-php ` once the migration is complete.
3030
31- Version 3.0 targets Docker Engine API v1.45. We plan
32- to add the missing API versions and bring support up to the latest Docker Engine
33- API. See [ Upgrading to 3.0] ( #upgrading-to-30 ) below for how to migrate from
34- existing releases.
31+ Version 4.0 works with Docker Engine API v1.45 to v1.56. See
32+ [ Upgrading to 4.0] ( #upgrading-to-40 ) below for how to migrate from existing
33+ releases.
3534
3635## Requirements
3736
3837- PHP 8.1 or later, with the ` mbstring ` extension.
3938- [ Composer] ( https://getcomposer.org/ ) .
40- - Access to a Docker daemon that accepts API v1.45 requests .
39+ - Access to a Docker daemon with API v1.45 or later (Docker Engine 26.0 or later) .
4140
4241## Installation
4342
4443``` bash
45- composer require " docker-php/docker-php:^3 .0"
44+ composer require " docker-php/docker-php:^4 .0"
4645```
4746
48- Composer installs ` docker-php/docker-php-api ` as a dependency. The 3.0 release
49- targets Docker API v1.45 and requires the matching generated API package .
47+ Composer also installs ` docker-php/docker-php-api ` , choosing the newest API line
48+ unless you require one. See [ Docker API versions ] ( #docker-api-versions ) .
5049
5150## Usage
5251
@@ -79,58 +78,64 @@ These guides cover callback streams, TTY output and raw response framing.
7978
8079## Docker API versions
8180
82- See the official [ Docker Engine API v1.45 reference] ( https://docs.docker.com/reference/api/engine/version/v1.45/ )
83- for endpoint descriptions, parameters and response schemas matching this API line.
81+ Each Docker Engine API version has its own ` docker-php/docker-php-api ` line with
82+ generated endpoints and models. The line uses the four-part version
83+ ` Jane-major.Docker-major.Docker-minor.revision ` : ` 7.1.56.0 ` means Docker API 1.56,
84+ generated with Jane 7, revision 0. To use a specific version, require its line:
8485
85- The client package follows semantic versioning. The generated API package uses
86- ` Jane-major.Docker-major.Docker-minor.revision ` : ` 7.1.45.0 ` means Docker API 1.45,
87- generated with Jane 7, revision 0.
88-
89- Keep generated API dependencies within one Docker specification. The
90- 3.0 client uses this range:
91-
92- ``` json
93- "docker-php/docker-php-api" : " >=7.1.45.0 <7.1.46.0"
86+ ``` bash
87+ composer require " docker-php/docker-php:^4.0" " docker-php/docker-php-api:>=7.1.51.0 <7.1.52.0"
9488```
9589
96- With the default connection factory, ` DOCKER_API_VERSION ` overrides the version
97- in request URLs:
90+ Pin a line if your code names generated models or calls methods that differ
91+ between versions. See the official
92+ [ Docker Engine API reference] ( https://docs.docker.com/reference/api/engine/ ) for
93+ each version's endpoints, parameters and response schemas.
9894
99- ``` bash
100- DOCKER_API_VERSION=1.52 php your-script.php
101- ```
95+ The bundled connection factory negotiates the version in request URLs: it uses
96+ the lower of the installed line and the daemon's maximum API version, as the
97+ Docker CLI does. ` DOCKER_API_VERSION ` or the factory's ` api_version ` option fix
98+ the version instead. Changing the URL version does not change the generated
99+ models. See [ API versions] ( https://docker-php.mintlify.site/api-versions ) .
100+
101+ ## Upgrading to 4.0
102102
103- Since 3.1.0, the factory's ` api_version ` option can pin the request version
104- directly in PHP. It takes precedence over ` DOCKER_API_VERSION ` . See
105- [ connection settings] ( https://docker-php.mintlify.site/connection#factory-options ) .
103+ ### From docker-php 3.x
106104
107- The generated endpoints and models still describe API v1.45. Changing the URL
108- version does not add newer API fields or endpoints. The client does not
109- automatically negotiate an API version with the daemon.
105+ - Composer now installs the newest API line unless you require one. Require
106+ ` docker-php/docker-php-api:>=7.1.45.0 <7.1.46.0 ` to keep the 3.x models.
107+ - Requests negotiate the API version with the daemon unless you set one.
108+ - Error statuses the generated endpoints do not handle throw an
109+ ` UnexpectedStatusCodeException ` . Call ` throwOnUnexpectedStatus(false) ` to
110+ return ` null ` instead.
111+ - ` Context ` applies ` .dockerignore ` . Call ` applyDockerignore(false) ` to archive
112+ the whole directory.
110113
111- ## Upgrading to 3.0
114+ Applications that cannot upgrade yet can stay on ` ^3.3 ` . See the
115+ [ upgrade guide] ( https://docker-php.mintlify.site/migration#from-3-x ) for model
116+ changes between API versions.
112117
113118### From docker-php 2.x
114119
115- Version 3 .0 requires PHP 8.1 or later, PSR-7 v2 and Jane 7-generated models.
120+ Version 4 .0 requires PHP 8.1 or later, PSR-7 v2 and Jane 7-generated models.
116121Review endpoint signatures, model types and HTTP client dependencies before
117122upgrading. Check log and exec consumers against the
118123[ streaming documentation] ( https://docker-php.mintlify.site/reference/streams ) .
119124
120- Change the client requirement to ` docker-php/docker-php:^3 .0 ` . Remove an explicit
121- ` docker-php/docker-php-api:4.1.* ` requirement, or change it to the API 1.45 range
125+ Change the client requirement to ` docker-php/docker-php:^4 .0 ` . Remove an explicit
126+ ` docker-php/docker-php-api:4.1.* ` requirement, or change it to one API line as
122127shown above. Update dependencies, test your application and commit its updated
123128` composer.lock ` .
124129
125130### From beluga-php
126131
127- Version 3 .0 continues the client maintained under ` beluga-php/docker-php ` .
132+ Version 4 .0 continues the client maintained under ` beluga-php/docker-php ` .
128133The PHP namespaces remain ` Docker ` and ` Docker\API ` .
129134
130135Remove the ` beluga-php/docker-php ` requirement and any explicit
131136` beluga-php/docker-php-api ` requirement from ` composer.json ` . Add
132- ` docker-php/docker-php:^3 .0 ` ; add the API 1 .45 range above if your application
133- requires the generated API package directly . Resolve the package changes
137+ ` docker-php/docker-php:^4 .0 ` ; to keep the Beluga v1 .45 models, also require
138+ ` docker-php/docker-php-api:>=7.1.45.0 <7.1.46.0 ` . Resolve the package changes
134139together, then test the application and commit its updated ` composer.lock ` .
135140
136141Install one package family at a time: the Beluga and original packages contain
0 commit comments