Repository navigation
Releases: docker-php/docker-php
Release list
v4.0.2
What's Changed
This release removes the funding entry from composer.json and the repository. The code and dependency constraints are the same as 4.0.1.
Full Changelog: v4.0.1...v4.0.2
v4.0.1
What's Changed
- build(deps): conflict with Jane runtimes before 7.14.4 and php-http/message before 1.16 in 81e25df
- chore(release): prepare 4.0.1 in 9673608
This release changes only dependency constraints. Lowest-dependency installs no longer pull in the abandoned php-http/message-factory package.
The client now conflicts with jane-php/json-schema-runtime and jane-php/open-api-runtime before 7.14.4, the Jane version that generates the API packages, and with php-http/message before 1.16. Older releases of those packages depend on php-http/message-factory. Normal installs already resolved newer versions, so most applications see no change.
The API packages carry the same constraints from 7.1.45.2, 7.1.46.1, 7.1.47.1 and 7.1.48.2 to 7.1.56.2.
Full Changelog: v4.0.0...v4.0.1
v4.0.0
What's Changed
- feat!: support Docker Engine API v1.45 to v1.56 in f2148a9
- docs: document the 4.0 client in 3df8a61
- test(docs): use the IDResponse model name from API 1.48 in ca82f41
Docker PHP 4.0 works with every Docker Engine API version from v1.45 to v1.56. Each version has its own docker-php/docker-php-api line. Composer installs the newest line unless you require one:
composer require "docker-php/docker-php:^4.0" "docker-php/docker-php-api:>=7.1.51.0 <7.1.52.0"The bundled connection factory now negotiates the request version. It pings the daemon once and uses the lower of the daemon's API version and the installed line, as the Docker CLI does, so an older daemon keeps working with a newer line. Setting api_version or DOCKER_API_VERSION keeps a fixed version.
Breaking changes
- API line. Applications that do not require an API line move from v1.45 to the newest on
composer update. Generated model names and fields differ between lines: API 1.48 renamedContainersIdJsonGetResponse200toContainerInspectResponse, and API 1.52 removedgetError()from build, pull and push frames. Requiredocker-php/docker-php-api:>=7.1.45.0 <7.1.46.0to keep the 3.x models. - Unexpected error statuses throw. Error statuses the generated endpoints do not handle throw
UnexpectedClientErrorExceptionorUnexpectedServerErrorException. CallthrowOnUnexpectedStatus(false)to returnnullas before. .dockerignoreis applied.Contextleaves out the paths a context's.dockerignoreexcludes. CallapplyDockerignore(false)to archive the whole directory.systemEvents()signature. It has a new optional$acceptparameter; subclasses that override it need the same parameter.
Other changes
FrameError::message()reads the error from build, pull and push progress frames on every API line.- From API 1.48, stats samples are
ContainerStatsResponsemodels. - Integers above
PHP_INT_MAX, such as thepids_stats.limitDocker reports for a container without a PID limit, decode asPHP_INT_MAXinstead of failing in the generated setters.
CI runs the full suite against every API line, with the newer lines negotiating down on Docker 28, and against Docker 29 for API v1.56.
Applications that cannot upgrade yet can stay on ^3.3. See the upgrade guide and API versions.
Full Changelog: v3.3.0...v4.0.0
v3.3.0
What's Changed
- feat(stats): stream container stats with StatsStream in 6be0a0f
- feat(errors): opt in to exceptions for unhandled error statuses in 26c4c94
- feat(context): opt in to applying .dockerignore in 9dd7c3a
- feat(build): accept several tags in imageBuild() in 0c271fa
- feat(websocket): add close() to attach streams in 459a1f2
- fix(attach): handle TTY and upgraded attach responses in 8024e95
- fix(websocket): encode 65,536-byte payload lengths correctly in 2165415
- fix(websocket): handle empty frames in attach streams in 17b620c
- fix(types): declare stream return types on Docker methods in 1cbbce1
- chore(deps-dev): allow guzzlehttp/guzzle ^8.0 in 6e27132
containerStats() now returns a StatsStream when streaming, which is the default. Each sample reaches onFrame() as a decoded object, and stop() ends the read. Before, the call blocked on Docker's endless response. stop() works on every callback stream, so build, pull, push and event readers can also finish from a callback.
containerAttachWebsocket() returns a working stream again. It returned null for every real WebSocket upgrade. The stream now answers pings, handles close frames, empty frames and stalled reads, and has a close() method. containerAttach() no longer loses the output of TTY containers. Docker Desktop's socket proxy does not forward WebSocket attach output; a Linux daemon works.
Two changes are opt-in because they change behaviour:
Docker::create()->throwOnUnexpectedStatus()throwsUnexpectedClientErrorExceptionorUnexpectedServerErrorExceptionwhen Docker returns an error status the generated endpoint does not handle, such as a 400 fromcontainerUpdate()with an invalid memory limit. Those calls currently returnnull.Context::applyDockerignore()leaves out the paths a context's.dockerignoreexcludes, matchingdocker build.
Without the opt-ins, behaviour is unchanged, and a deprecation notice marks each place the 4.0 default will differ.
imageBuild() accepts a list of tags in t, and the Docker stream methods declare their real return types for PHPStan and IDEs. Generated endpoints and models still target Docker Engine API v1.45.
See the documentation for examples, including continuous stats, unexpected error statuses and .dockerignore support.
Full Changelog: v3.2.0...v3.3.0
v3.2.0
What's Changed
- feat(exec): add nonblocking interactive sessions in 0ffd32a
- test(exec): make the memory regression check allocator-independent in fbdb2cc
- docs(exec): document worker safety and canary validation in cd76433
Docker::execStartInteractive() lets applications send stdin while polling stdout and stderr. Sessions support partial stdin writes, non-TTY stdin EOF, bounded output polling, streaming deadlines and a wait() tick callback for application heartbeats.
This is a backwards-compatible addition. Existing blocking execStart() and wait() calls are unchanged, and generated endpoints and models still target Docker Engine API v1.45.
Interactive exec requires the bundled socket transport, with Unix, TCP or TLS connections. Guzzle and other custom transports are not supported for this method. TTY output combines stdout and stderr, and TTY stdin half-close is rejected.
Streaming deadlines begin after the HTTP upgrade. Closing a session or reaching its deadline does not kill the command inside the container; use a container-side timeout where needed. Applications remain responsible for locks, cancellation and safe retry decisions.
See the interactive exec guide for examples, limitations and the live queue/Redis canary results.
Full Changelog: v3.1.0...v3.2.0
v3.1.0
What's Changed
- feat(factory): add an explicit
api_versionoption in 83ba0f6
Set api_version in DockerClientFactory::create() to choose the request URL version directly in PHP. It takes precedence over DOCKER_API_VERSION without changing the process environment. If omitted, the existing environment fallback and default API version 1.45 remain unchanged.
This is a backwards-compatible addition. Generated endpoints and models still target Docker Engine API v1.45; changing the request version does not add newer API fields.
See the API-version documentation.
Full Changelog: v3.0.0...v3.1.0
v3.0.0
What's Changed
- chore(package): restore the
docker-php/docker-phppackage name and require the matching API v1.45 package in 948726b - fix(logs): decode multiplexed and TTY container output in 3afcdd7
- fix(exec): decode upgraded and TTY command output in 83d008d
- fix(transport): support explicit endpoints, custom Unix sockets, TLS and live output in 3907105
- test: cover the renamed packages, generated normalizers and live streaming in 629a8fb
- docs: add Mintlify documentation, connection examples and migration guidance in 1f4aa08
Version 3.0 continues the maintained Beluga client in the original repository and targets Docker Engine API v1.45. It requires PHP 8.1 or later, the mbstring extension, PSR-7 v2 and Jane 7 runtimes.
Upgrade notes:
- The PHP namespaces remain
DockerandDocker\API. Replace both Beluga package names together; do not install both package families. - Review endpoint signatures and generated model types when upgrading from 2.x. The old
DockerAsyncclient is not available in 3.0. - Use
onStdout()andonStderr()withwait()for decoded log and exec output. Raw responses still contain binary frame headers for non-TTY output. Raw-stream logs also require permission to inspect the container's TTY setting. - Environment variables are optional. Use the default local socket, configure the bundled factory in PHP, or supply a configured PSR-18 client. Streaming requires an unbuffered transport with support for upgraded connections.
See the documentation and migration guide before updating your application.
Full Changelog: v2.0.0...v3.0.0
v2.0.0
1.24.0
1.24 Release for Docker 1.12
- All changes from API : https://docs.docker.com/engine/reference/api/docker_remote_api/#/v1-24-api-changes
- [BC BREAK] : Listing containers now return a list of
ContainerInfoobject (instead ofContainerConfig) - Minor fixes (see commit list)