There is an original wbraganca/yii2-dynamicform . Link to composer.json .
There is a fork in which some spiro-stathakis/yii2-dynamicform bug has spiro-stathakis/yii2-dynamicform . Link to composer.json

There is an extension in my project that has "wbraganca / yii2-dynamicform" in its dependencies: "dev-master"

In the composer.json project, I connect the spiro-stathakis/yii2-dynamicform and specify the link to the repository. As a result, I have downloaded both extensions (original and forged), but the project uses the original version.

How to make so that forks would be used?

    1 answer 1

    If you need to use the fork version of some original package (this could be yours or someone else's fork) as your project, then you need:

    1. Add VCS repository with package fork:
     composer config repositories.yii2-dynamicform vcs spiro-stathakis/yii2-dynamicform 
    1. Install the package (with the original name!) wbraganca/yii2-dynamicform :
     composer require wbraganca/yii2-dynamicform dev-master 
    1. Profit!

    PS: dev-master - the name of the repository branch, in this case it is master


    For your particular case, you need:

    1. Remove installed wbraganca/yii2-dynamicform and spiro-stathakis/yii2-dynamicform

    2. Return original package name to composer.json

    3. Install the wbraganca/yii2-dynamicform :

     composer require wbraganca/yii2-dynamicform dev-master 
    1. Profit!

    PS: dev-master - the name of the repository branch, in this case it is master

    • It turns out, everything depends on the name in composer.json ? The problem is that this is not my fork. In principle, I solved the problem in the same way - I forked the project myself and changed the name to original. But here I have another question: is it bad-practice forked from someone else's project and change the name of the vendor? Or is there any solution without changing the name ? Something like, "Comrade composer, if they ask the vendor/package , you do not go there, you go to court and download another-vendor/package - Roman Andreev
    • If the name of the vendor or package is changed, then this is a different package with all the consequences. I answered your second question in my answer - any package (vendor / name) can be replaced with a package of the same name from the local repository. If local repositories are set, the search for installing the requested packages is done by composer first in them, and in case of failure, the search continues in the global repositories by default. - Jigius