Composer (PHP)
NORA hosts Composer packages and caches a Composer repository (Packagist by default) for Composer 2. It is off by default: set [composer] enabled = true or NORA_COMPOSER_ENABLED=true; NORA_REGISTRIES_ENABLE=all includes it. Composer 1 (the providers API) is not supported.
Client Configuration
Section titled “Client Configuration”In composer.json:
{ "repositories": [ { "type": "composer", "url": "https://nora.example.com/composer" }, { "packagist.org": false } ]}With authentication on, give Composer a token for the registry host:
composer config --global http-basic.nora.example.com <user> <token>composer audit works through NORA: it is forwarded to the upstream’s advisories API. A hosted or internal package name is never sent upstream.
Publishing
Section titled “Publishing”The zip is the request body:
curl -u user:token -X PUT --data-binary @pkg.zip \ https://nora.example.com/composer/packages/upload/acme/greeter/1.0.0composer.jsonis read from the zip root or its single top-level directory; itsnamemust match the path’svendor/package.- Versions are immutable: a second upload of the same version returns
409. - Branch (dev) versions are refused (
400); upload a tagged release. - A package with an uploaded version is served only from its uploaded versions, so a package of the same name upstream cannot take it over.
Upstream Proxy
Section titled “Upstream Proxy”config.toml:
[composer]enabled = trueproxy = "https://repo.packagist.org"proxy_timeout = 30metadata_ttl = 300 # secondsserve_stale = trueEnvironment variables:
| Variable | Description | Default |
|---|---|---|
NORA_COMPOSER_ENABLED | Enable the Composer registry | false |
NORA_COMPOSER_PROXY | Upstream Composer repository; empty serves hosted packages only | https://repo.packagist.org |
NORA_COMPOSER_PROXY_AUTH | Upstream auth (user:pass) | — |
NORA_COMPOSER_PROXIES | Ordered upstreams (url|user:pass,url2); replaces proxy | — |
NORA_COMPOSER_PROXY_TIMEOUT | Upstream timeout in seconds | 30 |
NORA_COMPOSER_METADATA_TTL | Seconds a cached upstream document is served before it is revalidated | 300 |
NORA_COMPOSER_SERVE_STALE | Serve the cached document when the upstream fails | true |
NORA_COMPOSER_REVALIDATE | Conditional requests for a stale document | true |
NORA_COMPOSER_GITHUB_TOKEN | Token for archive downloads from api.github.com (60 anonymous requests an hour) | — |
NORA_COMPOSER_KEEP_SOURCE | Keep a version’s source in proxied metadata when curation is off | true |
An archive is fetched only from the URL the cached upstream metadata lists for that exact version, so NORA is not an open proxy. Archives are cached permanently with a SHA-256 sidecar; the upstream’s dist.shasum is verified when it gives one.
Curation
Section titled “Curation”Curation judges a package by vendor/package: the blocklist and allowlist, plus [curation.composer] for this registry (min_release_age, quarantine, quarantine_ttl; NORA_CURATION_COMPOSER_*). With curation on, proxied metadata lists only versions NORA serves an archive of, so Composer cannot fall back to cloning the source of a refused version.
Limitations
Section titled “Limitations”- Deleting or unpublishing a version is not implemented.
- Search and package list endpoints are not implemented.
- Zip64 archives are not accepted.
Full details: COMPAT.md.