V
V
VX2992018-08-02 22:03:47
Composer
VX299, 2018-08-02 22:03:47

How to properly organize development with packages?

I have :
phpStorm
application on yii2 (main project)
a separate "cart" package/component connected via composer (personal private repository)
Question:
How can I immediately edit the "cart" package from the main project?
Now I have to open another "cart" project, make changes there, upload it to the repository, then open the main project and do a composer update

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
D3lphi, 2018-08-02
@VX299

There is a plugin for composer - wikimedia/composer-merge-plugin . It allows you to include local packages in your project.
Composer.json then looks something like this:

{
    "require": {
        "wikimedia/composer-merge-plugin": "dev-master"
    },
    "extra": {
        "merge-plugin": {
            "require": [
                "submodule/composer.json" // Путь до файла composer.json вашей библиотеки.
            ]
        }
    }
}

Now you can change the source code of your library and be satisfied with the result right away.

K
Kirill Nesmeyanov, 2018-08-03
@SerafimArts

Composer can include dependencies from local directory:
composer.json

{
    "repositories": [
        {
            "type": "path",
            "url": "./путь_к_папке_с_зависимостью"
        }
    ],
    "require": {
        "yourpackage/name": "*"
    }
}

So the plugin from D3lphi cited as an example seems to be no longer needed for two years.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question