Skip to main content

Create a Composer Repository

To install or publish Composer packages, you must create a Composer repository. Check out Nexus Repository Management and Repository Types to learn more.

Composer Proxy Repository

Use Nexus proxy repository when you want to download packages and centralize package caching of external dependencies. To learn more, check Proxy Repositories.

To create a Composer proxy repository, take the following steps:

  1. Navigate to SettingsRepositoryRepositories.

  2. Select Create repository.

  3. From the list of recipes, select composer (proxy).

  4. In the form that appears, complete the required fields.

  5. Complete the additional fields for configurations you wish to add for creating your repository. Available configurations differ by repository format and type. See Configurable Repository Fields for more details.

  6. Select Create repository.

    composer-proxy.png

Note

Nexus Repository can proxy only repositories that provide Composer v2 metadata. Repositories that provide only Composer v1 metadata cannot be proxied.

Composer Hosted Repository

Use Nexus hosted repository when you want to publish and store your own internal artifacts and third party components, so they can be consumed via Nexus. To learn more, check Hosted Repositories.

To create a Composer hosted repository, take the following steps:

  1. Navigate to SettingsRepositoryRepositories.

  2. Select Create repository.

  3. From the list of recipes, select composer (hosted).

  4. In the form that appears, complete the required fields.

    • Repository Name, for example composer-hosted

    • Blob store

  5. Complete the additional fields for configurations you wish to add for creating your repository. Available configurations differ by repository format and type. See Configurable Repository Fields for more details.

  6. Select Create repository.

    composer-hosted.png

Tip

To add Composer archives through the Nexus Repository user interface, see Uploading Components. Each archive must contain a valid composer.json file with a package name in vendor/package format. The values in version field in composer.json and the optional Version field in Upload UI must be the same.

If hosted repository metadata must be repaired, configure and run the Repair - Rebuild Composer repository metadata (p2 manifests) task. Select the hosted Composer repository to repair. You can optionally limit the task to a specific vendor or package. Configure Base URL only when it is not configured. See Tasks.

Composer Group Repository

Use Nexus group repository when you want to combine multiple other repositories (proxy, hosted, and other groups) and expose them through a single URL. To learn more, check Group Repositories.

To create a Composer group repository:

  1. Navigate to Settings → RepositoryRepositories.

  2. Select Create repository.

  3. From the list of recipes, select composer (group).

  4. In the form that appears, complete the required fields.

    • Repository Name, for example composer-group

    • Blob store

    • Member repositories in desired order

  5. Complete the additional fields for configurations you wish to add for creating your repository. Available configurations differ by repository format and type. See Configurable Repository Fields for more details.

  6. Select Create repository.

    composer-group.png

Note

Member order determines package precedence. If multiple member repositories provide the same package version, Nexus Repository uses the package from the first matching member.