Best way to share custom PHP code amongst projects

旧时模样 提交于 2019-12-06 11:06:52

Perhaps the best way (I am using too) is to host the common code in a versioning system such as Git or Mercurial or SVN and checkout this code in each related project. As long such a project does not have updates you can continue to work on your common code. In the case you want to touch a project again that utilizes the common code, you need to perform a source code update or pull. Then you update your project sources according to the changes of the common source base.

What about include_path PHP directive?

Just add include_path, for example /usr/share/php5/

and include your file like yourfile.php from each project

linepogl

Use Git or Mercurial for that. In both of them, you can create sub-modules or sub-repositories.

http://kernel.org/pub/software/scm/git/docs/git-submodule.html

https://www.mercurial-scm.org/wiki/Subrepository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!