Composer v2 repositories, distribution archives, and lockfiles
Composer discovers p2 metadata from packages.json and downloads the ZIP at dist.url. Hosted exposes the upload endpoint. Composer resolves dependencies, writes the lockfile, and installs packages.
Create repositories
Run these Bash commands with an authenticated administrator arkactl profile and jq. Replace the example address with your HTTPS endpoint. Publish to Hosted. Group looks in Hosted first, then in Proxy. Grant the publishing account write access to Hosted and the consuming account read access to Group and the relevant members.
For each consuming or publishing identity, sign in with its profile and run arkactl --json tokens create --name composer-ci --expires-in-days 30 | jq -er .plaintext. Send the output directly to the CI secret store. Use a separate read and write token for the examples below.
export ARKA_URL=https://packages.example.org
hosted=$(arkactl --json repo create --name composer-hosted --type hosted --format composer | jq -er .id)
proxy=$(arkactl --json repo create --name composer-proxy --type proxy --format composer \
--upstream-url https://repo.packagist.org | jq -er .id)
arkactl repo create --name composer-group --type group --format composer --member "$hosted,$proxy"
WRITE="$ARKA_URL/repository/composer-hosted"
READ="$ARKA_URL/repository/composer-group"Publish a ZIP
Place composer.json in the ZIP root or its sole top-level directory. Use a vendor/package name and match any explicit version to the upload URL. The example packages an existing acme/widget 1.2.3 project.
composer validate
zip -r ../widget-1.2.3.zip composer.json src/
curl -fsS -H "Authorization: Bearer $ARKA_WRITE_TOKEN" \
-T ../widget-1.2.3.zip "$WRITE/dists/acme/widget/1.2.3.zip"Configure the consuming project
{
"repositories": [
{"type": "composer", "url": "https://packages.example.org/repository/composer-group"},
{"packagist.org": false}
],
"require": {"acme/widget": "1.2.3"}
}Inject COMPOSER_AUTH through the CI secret store, using {"http-basic":{"packages.example.org":{"username":"READER","password":"READ_TOKEN"}}}. Credentials match by hostname. On workstations use a personal auth.json file. Commit composer.lock after the first resolution and install from it during deployment.
composer update acme/widget --prefer-dist # Update this package in an existing lockfile.
# composer install creates a lockfile on the first run in a new project.
COMPOSER_CACHE_DIR="$(mktemp -d)" composer install --prefer-dist --no-interaction
composer show acme/widget| Symptom | What to check |
|---|---|
| Upload rejected | Check the location of composer.json in the ZIP, package name, and version. The target should end in dists/acme/widget/1.2.3.zip. |
| Download always comes from another source | Inspect dist.url in composer.lock and the project’s default Packagist source. Proxy may return an upstream HTTPS distribution URL that the client must be able to reach. |
| Root index returns 200 but the package is missing | Check packages.json and p2/acme/widget.json as the same reader, then verify version constraints and Group member access. |