Most of the time I'm developing Joomla extensions. It happens often that one needs to reuse helper classes, installation classes etc. Up until now I've just copy pasted code around. I know, I know... but this is always the fastest solution, that in the long term turns out to be the slowest. I've been thinking now some time how to manage the dependency management in my projects. I've tested out composer and I like it, but it doesn't seem to be a good fit for me. Let me elaborate. Let us say we have the following folder structure
projects
- library A
- library B
- project A
- project B
- project C
Project A and B both use the library A and B, where project C uses only library A. If I were to use composer then the structure of the folder would look like this:
projects
- library A
- library B
- project A
-- vendor
--- library A
--- library B
- project B
-- vendor
--- library A
--- library B
- project C
-- vendor
--- library A
I don't know - this would be maybe fine if I was using 3rd party libraries that I'm not developing myself, but if I already have the code of library A and library B on my hard drive - why the * will I copy them to the vendor folder? Not only that, but whenever I update my library, I need to do composer update in each project to get the latest library version. This seems kinda contra productive to me?
So what I came up with is -> symlinks. I can place a symlink to my library A and B and then whenever I make a change -> the change will be auto-applied to all of my projects.
Whenever I zip the extension my phing scripts will get the libraries and include them in the zip. So this seems to be good for my development workflow, but there is another issue. Some of my projects are available on github and other developers fork them, do whatever they like with them etc. Now I need to explain to them, that they should create the same directory structure as I have in order for the build scripts to function. They will download project A, but they will have to go and download library A and B.
This is where composer is great. But if I want to have it easy on my, I need to use symlinks... How do you manage such situation? What is your workflow and how do you structure your projects and libraries in order not to have to copy code all over the place and at the same time make it easy for other developers to get going in seconds? Any tips are welcome!