如何与主应用程序一起开发另一个子模块。 [composer,php] [英] how to develop another sub-module along with the main application. [composer,php]

查看:304
本文介绍了如何与主应用程序一起开发另一个子模块。 [composer,php]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道git子模块是如何工作的,以及我们如何使用它。

I know how git submodules works, and how we can use it..

现在我处于主要应用程序依赖于许多其他的作曲家包我必须制作和开发一个小的另一个包,它将与主项目(种类的lib)。

now i am in situation where main application that depends on many other composer packages and along with that i have to made and develop a small another package that will be separate from main project (kind of lib.)

,所以我如何开发这个小包主要项目,而不使其单独的项目,并且不发布到任何vcs只是与该项目目录。所以后来我可以拿出来,做任何我想要的。

so how can i develop this small package along with main project without making it separate project and without publishing to any vcs just withing that project directory. so later i can take it out and do whatever i want.

我不认为我需要把我的代码在/ vendor目录,并开始在那里不知道是否可能。)

i don't think that i need to place my code in /vendor directory and start developing there (don't know if its possible?)

什么是你认为我没有这么多的作曲家的经验,但现在爱的最好的方式。

whats the best way you think i have not so much experience with composer but now loving it.

[实际上它的非子模块,它只是一个主应用程序的依赖]

[actually its not sub module, its just a dependency for main application]

推荐答案

将该部分代码分离成它自己的包,并避免必须为该小代码部分创建单独的存储库。这样做可能意味着为这个库创建一个单独的命名空间,在目录结构中保持单独的名称空间(你知道你可以有多个键 - 值对PSR-0或PSR-4自动加载在你的主 composer.json ),当时间到来时,将代码移动到一个包中,同时拆分autoload定义(即删除主包中的库自动加载并添加一个适当的版本它到新的Composer库中)。

You can always separate that part of the code later into a package of it's own, and avoid having to create a separate repository for that small code part. Doing this would probably mean you create a separate namespace for this library, keep it separate in the directory structure (you know you can have more than one key-value-pair for PSR-0 or PSR-4 autoloading in your main composer.json), and when the time has come, you move the code into a package, also split the autoload definition (i.e. delete the library autoloading in the main package and add an appropriate version of it into the new Composer library).

另一方面,问题是如果你把这个库分离成新的Composer包?为什么不从一个专门的存储库开始?但即使你想同时拥有这两者,Git也有一个工具:将子目录分离Git存储库

On the other hand, the question is how keen you are grabbing all that development history later if you do separate this library into a new Composer package? Why not start with a dedicated repository right now? But even if you want to have both, Git has a tool for this: Detach subdirectory into separate Git repository

这篇关于如何与主应用程序一起开发另一个子模块。 [composer,php]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆