Skip to content

composer

Alena edited this page Mar 31, 2023 · 4 revisions

Composer

Composer repository is a dependency manager and packages sharing tool for PHP packages. Here is the configuration example:

repo:
  type: php
  url: http://{host}:{port}/{repository-name}
  storage:
    type: fs
    path: /var/artipie/data

The Composer repository configuration requires url field that contains repository full URL, {host} and {port} are Artipie service host and port, {repository-name} is the name of the repository (and repository name is the name of the repo config yaml file). Check storage documentation to learn more about storage setting.

To upload the file into repository, use PUT HTTP request:

curl -X PUT -T 'log-1.1.4.zip' "http://{host}:{port}/{repository-name}/log-1.1.4.zip"

To use packages from Artipie repository in PHP project, add requirement and repository to composer.json:

{
  "config": { "secure-http": false },
  "repositories": [
    { "type": "composer", "url": "http://{host}:{port}/{repository-name}" },
    { "packagist.org": false }
  ],
  "require": { "log": "1.1.4" }
}