Testing and developing custom extensions

Hi, I don’t know if this is correct forum to ask this question so I’d like to apologise if not ;)

I’m new to Yii framework, already following guide for Yii2. I added module for user management via composer - it is nicely downloaded inside vendor directory. But there are still some missing features I’d like to implement, so I forked this repo on GitHub and here comes the question.

How should I implement and test changes to this module so I can keep track of my main project (already a git repository) and upload changes to module to it’s own repo? I guess I shouldn’t change much when the module is inside vendor directory (or should I?).

The only thing that comes to my mind is blindly pushing changes into GitHub repository and pulling them via composer but this seems like an awful idea.

I’d be very grateful for all your answers. Thank you!

Normally if you want to modify and enhance modules the suggested way is overriding classes and methods adding features or modifying the pre-existent ones. If the user module you added is dektrium/yii2-user there is a brief documentation on how to override Models, Controllers and Views, you can find it here. I strongly recommend to avoid any modification of classes and files inside vendor folder. Those files are automatically handled by Composer. Hope this can help you.

Actually I managed to solve it this way:

When testing new changes, I’m modifying files inside vendor.

When I confirm correct behaviour of my changes, I copy these files into my forked repository, push it into github and then run composer to download changes for that package from my github branch instead.

My custom changes inside vendor directory are overriden by composer and replaced with files from github repository (actually they are the same files). More info - http://www.yiiframework.com/wiki/673/using-your-own-forked-version-of-extensions-with-composer/

What I do, is first install the extension so that it exist in the ‘vendor’ directory.

Then I clone the extension in a different directory, like you’d normally do when you want to work on something, and then I rename the extension dir in the ‘vendor’ dir, create a soft link to my different directory.

Now, I run composer dump-autoloads whenever something changes in my linked copy.

That is so much easier than following the article :)

When you are done testing, push your changes (in other directory), remove the symlink in ‘vendor’, rename the renamed dir and run composer update yourthing.