Reputation: 879
Thanks in advance for your help...
I come from a Java/Maven development environment and have been extremely familiar with Java dependencies and sharing common code using Maven.
I've recently moved to an organization that is PHP based. We have 3 different projects, all which have a shared code base. Up until now, the dev's have simply copy/pasted code from one project to another to keep the shared code in sync across projects.
Previously in the Java/Maven world, the shared code would be maintained in a separate project, and create a JAR. You would then "mvn install" that module, which would install that JAR in a local repository, and the project that needs that "dependency" would download it from your local repository, allowing for quick development of shared code AND the project using the shared code.
I've been looking for something similar in PHP and haven't been able to find it. I've found suggestions like Git submodules, PHARs and PEARs. But I'm seeing people complain about Git Submodules (https://softwareengineering.stackexchange.com/questions/158847/recommended-methodology-for-working-with-shared-libraries-and-mercurial), and our devs are saying that using PHARs and PEARs incredibly slow down dev efforts because they have to build the shared library before they can use the shared library (not to mention I can't find a accepted standard of "building" PHP).
Another option I've considered is having the shared code live "somewhere" on the file system and referencing the filesystem in code. This is unattractive to me because it makes the environment difficult to set up (imagine if you have a 5 common libraries, you have to check all 5 out just to get your code to work).
So my question is, what are people using to tackle this issue? Also please correct any assumptions I may have made above (re: PEARs, PHARs, PHP Building, etc)!
Upvotes: 3
Views: 1157