For the complete documentation index, see llms.txt. This page is also available as Markdown.

PHP Composer

spinner

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

Create Artifact Registry and Setup Client
  1. Navigate to the Artifact Registry module in your Harness project.

  2. Click on New Artifact Registry.

  3. In the Registry Type dropdown, select PHP Composer Registry.

  4. Provide a Registry Name.

    • Your registry name must start with a letter and can include lowercase alphanumerics, _, . and -.

  5. Optionally, add a Description and Labels for better organization.

  6. Choose visibility between Public and Private. By default, the visibility is set to Private.

  7. Click Create Registry to finalize.

PRIVATE REGISTRY

This registry will serve as your private PHP Composer registry within Harness.


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

Create an Upstream Proxy in Registry

Configure the upstream proxy in your registry

Configure Upstream Proxies in Registry

Create an upstream proxy

  1. In the Artifact Registry module, click the dropdown next to New Artifact Registry and select Upstream Proxy.

  2. Choose PHP Composer Registry as the proxy type.

  3. Enter an Upstream Proxy Key.

  4. Select your Source:

    • Packagist

    • Custom

  5. If you select Custom, enter your Remote Registry URL.

V1 REPOSITORY SUPPORT

If you are using a Composer v1 repository, select the Source as Custom, and then in the Remote Registry URL field, enter your v1 repository URL.

  1. Choose your Authentication method (Anonymous by default for public registries).

  2. Click Create Upstream Proxy to establish the connection.

Configure the upstream proxy in your registry

  1. In the Artifact Registry module, select an existing PHP Composer Artifact Registry.

  2. Select the Configuration tab.

  3. Under Advanced (Optional), select Configure Upstream.

  4. Select from the list of compatible proxies to add them to your registry.

  5. Click Save to save the configuration.

UPSTREAM PROXY CACHING

If a PHP Composer package isn’t found in your Harness registry, the upstream proxy fetches it from an external registry like Packagist, reducing duplication and improving package resolution.


Publish & Install PHP Composer packages

Configure Authentication

Step 1: Generate an identity token for authentication

  1. In your Harness PHP Composer Artifact Registry, click Setup Client.

  2. 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?