Allow Composer to authenticate against a private third-party Composer repository and download PHP packages from it.
You can now use composable image to install runtimes and tools in your application container. To find out more, see the Composable image topic.
Packagist is the primary Composer repository for public PHP packages.
But you can also have Composer download PHP packages from a private, third-party Composer repository.
To make sure Composer has the necessary credentials to do so,
follow the instructions on this page.
2. Set up Composer authentication using a variable
To allow Composer to successfully authenticate when accessing the declared private repository,
set an env:COMPOSER_AUTH variable for your project.To do so, run the following command:The env: prefix means that the variable is exposed
as its own Unix environment variable.
The --visible-runtime false and --visible-build true flags mean the variable is available to Composer only during the build.
For security reasons, make sure that the authentication credentials aren’t cached in your project’s build container.
To do so, run the following command:
Access dependencies downloaded from a private repository
When you download a dependency from a private third-party Composer repository,
that dependency is usually hosted in a private Git repository.
Access to private Git repositories is restricted through the use of SSH keys.
But most private Composer tools mirror tagged releases of dependencies
and serve them directly without hitting the Git repository.
To avoid having to authenticate against a remote Git repository,
make sure your dependencies specify tagged releases.
Last modified on September 16, 2026
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.