Yii 2.0: Using your own forked version of extensions with composer


So you want to use a fork of any existing vendor extension with your Yii 2 install and use the fork, instead of original source. This does not need you to push any update or register your package on packagist.org. You are recommended to follow the approach below:

Step 1

Let's take an example. Let's say you want to fork the package kartik-v/yii2-widgets.

Step 2

Fork the library on GitHub. Its important for you to check if the source contains a valid composer.json file. This is important for the rest of the steps to work. After the fork, let's say your forked package version is now at https://github.com/yourname/yii2-widgets.

Step 3

Push your library changes to the main branch (You can check which one it is on Packagist, under “Source:” – Example).

Step 4

Override your composer.json in your Yii2 applications root folder to point to your fork repository. The original composer.json before would have something like below:

"require": {
    "kartik-v/yii2-widgets": "*"

The composer.json after edit will need to have these additional lines

                "type": "vcs",
                "url": "https://github.com/yourname/yii2-widgets"
    "require": {
        "kartik-v/yii2-widgets": "*"

Step 5

Now run the following command from console in your application root.

php composer.phar update

Composer should tell you that files have been modified. Answer 'yes' to any questions. This should enable to use your own fork.

Total 1 comment

#17757 report it
ThePr0f3550r at 2014/07/19 11:00pm
permit to integrate yii2 heart

I permit to integrate your amazing extension (grid and widget) with my extension .. yii2-heart

Leave a comment

Please to leave your comment.