Skip to content

feat: set tc-php/<version> User-Agent header for Docker API requests#69

Merged
shyim merged 6 commits into
mainfrom
feat/user-agent-header
Jun 26, 2026
Merged

feat: set tc-php/<version> User-Agent header for Docker API requests#69
shyim merged 6 commits into
mainfrom
feat/user-agent-header

Conversation

@mdelapenya

Copy link
Copy Markdown
Member

All other testcontainers language libraries (Java, Go, .NET, Node, Python, Rust, Ruby, Elixir) set a tc-<lang>/<version> User-Agent header on Docker Engine HTTP requests. PHP currently sets none.

This PR adds User-Agent: tc-php/<version> to all Docker API requests by:

  • Calling DockerClientFactory::createFromEnv() to build the base HTTP client
  • Wrapping it in a PluginClient with a HeaderDefaultsPlugin that injects the User-Agent header
  • Reading the version at runtime via Composer\InstalledVersions::getPrettyVersion('testcontainers/testcontainers')
  • Passing the wrapped client to DockerClient::create()

No new dependencies required — HeaderDefaultsPlugin and PluginClient are already part of the transitive dependency tree via beluga-php/docker-php.

@netlify

netlify Bot commented Jun 25, 2026

Copy link
Copy Markdown

Deploy Preview for testcontainers-php ready!

Name Link
🔨 Latest commit d2f2691
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-php/deploys/6a3d5b66cc21440008f83e60
😎 Deploy Preview https://deploy-preview-69--testcontainers-php.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8528b06994

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ContainerClient/DockerContainerClient.php Outdated
@rw4lll rw4lll requested review from rw4lll and shyim June 25, 2026 16:11
@rw4lll

rw4lll commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

@shyim could you also pls take a look?🙂

@shyim shyim merged commit 75bca05 into main Jun 26, 2026
7 checks passed
@shyim

shyim commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

@shyim shyim deleted the feat/user-agent-header branch June 26, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants