How to set dependencies with composer if I have several .json composers in several directories?

For example, let's say that we have something like this:

.
├── app
│   ├── module1
│   │   └── composer.json
│   └── module2
│       └── composer.json
└── composer.json

In each, composer.jsonwe have different dependencies.

How to install all the necessary packages with a single command?

+4
source share
2 answers

For example, you can create Makefileone that combines the necessary steps.

However, you can set dependencies for all files composer.jsonby specifying the path to the working directories (directories containing these files composer.json) using the option --working-dir.

See https://getcomposer.org/doc/03-cli.md#global-options :

- working-dir (-d). , .

Makefile

:

.PHONY: composer

composer:
    composer install --working-dir app/module/1
    composer install --working-dir app/module/2
    composer install

$ make composer

, beberlei/fiddler PHP .

0

~ 2016 , .

composer.json:

{
    "repositories": [
        { "type": "path", "url": "app/module1" },
        { "type": "path", "url": "app/module2" }
    ]
}

:

composer update

:)

0

Source: https://habr.com/ru/post/1569129/


All Articles