PHP Composer
Prerequisites
Ensure you have the PHP Composer CLI (
composer) and Harness CLI installed on your local machine.Access to a Harness account with appropriate permissions to create registries and connectors.
Create a PHP Composer Artifact Registry
Navigate to the Artifact Registry module in your Harness project.
Click on New Artifact Registry.
In the Registry Type dropdown, select PHP Composer Registry.
Provide a Registry Name.
Your registry name must start with a letter and can include
lowercase alphanumerics,_,.and-.
Optionally, add a Description and Labels for better organization.
Choose visibility between Public and Private. By default, the visibility is set to Private.
Click Create Registry to finalize.
Configure an Upstream Proxy (Optional)
An upstream proxy allows your registry to fetch PHP Composer packages from external sources if they are not available locally.
Create an upstream proxy
In the Artifact Registry module, click the dropdown next to New Artifact Registry and select Upstream Proxy.
Choose PHP Composer Registry as the proxy type.
Enter an Upstream Proxy Key.
Select your Source:
Packagist
Custom
If you select Custom, enter your Remote Registry URL.
Choose your Authentication method (Anonymous by default for public registries).
Click Create Upstream Proxy to establish the connection.
Configure the upstream proxy in your registry
In the Artifact Registry module, select an existing PHP Composer Artifact Registry.
Select the Configuration tab.
Under Advanced (Optional), select Configure Upstream.
Select from the list of compatible proxies to add them to your registry.
Click Save to save the configuration.
Publish & Install PHP Composer packages
Configure Authentication
Step 1: Generate an identity token for authentication
In your Harness PHP Composer Artifact Registry, click Setup Client.
Click Generate Token to generate an identity token.
Step 2: Configure Composer to use the token for authentication
Publish Package
Step 1: Create a Composer archive from your project
Step 2: Upload the Composer package to the Harness registry using Harness CLI
Install Package
Step 1: Add the private registry to your project's composer.json
Step 2: Install a package using Composer
Last updated
Was this helpful?