douluan1533 2016-05-24 11:54
浏览 58

PHP,GIT,可重用组件的位置

Thanks for your attention, this is a question of organization, I work with PHP and GIT for version control. I use Netbeans IDE to program, GIT integrated (although I am still a rookie).

Normally, I follow the approach that Symfony2 specifies for organize the project files, but I use my own framework for my projects. The (main) question is: Any component or code part which has its own version control must be located under the /vendor/directory?

For example: I have my project files in src\Acme\ProjectX\, also the utility package which use all my projects: src\Acme\Util\, and it is under the version control too (GIT).

and now let's remember the basic skeleton of a project based on Symfony or similar:

/app (application related elements)
/src (source code of the project)
/vendor (third party libraries)
/web (front end controller, the web directory, assets resources etc...)

So, Must be 'Acme\Util' included in the vendor directory? And, is necessary to use composer to declare the dependences?

In addition, the Utility package has a lot of classes but only few are used in projects. Must I remove those are not using by the project.

Summarizing, It will be nice if someone can contribute his knowledge for help me to represent an scenario like this.

I hope I could explained... Thanks in advance!

  • 写回答

1条回答 默认 最新

  • douzhang5121 2016-05-24 12:14
    关注

    Vendor directory

    It's a good practice to separate external dependencies and the application code. If you are using Composer you can change it to something else.

    Unused classes

    Unused classes shouldn't matter if they aren't being loaded. They'll just take a bit of extra disc space.

    It might be a good idea to separate the Utility package into multiple packages if you find yourself frequently using only a small part of it.

    Dependency managers

    It isn't necessary to use a dependency manager, but it sure does help. Having to install, configure and maintain everything manually (especially with many dependencies and sub-dependencies) would be a horror.

    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)