ZF2 private repository for project

2019-09-07 04:28发布

问题:

I started ZendSkeletonApplication via Composer. I will need for my project PRIVATE repository (Git). How to do it? Skeleton have now .git files so how I can work with my project for example on BitBucket?

Regards

回答1:

The best way to create a ZF2 skeleton project from scratch is to use ZFTool (http://framework.zend.com/manual/2.1/en/modules/zendtool.introduction.html). Install it to /usr/local/bin (with executable permissions) and then you can do this:

$ zftool.phar create project project_name

This will give you a skeleton application in the project_name folder which is completely git free.

Now create a private repository on BitBucket and follow the instructions for setting up with code already on your disk.

Note that the project created in project_name has a .gitmodules file. If you're using Composer, you can just delete this file before you add to BitBucket. If you want to use submodules, then its set up with ZF2 as a submodule ready for you to init and update.



回答2:

By utilizing the submodule feature of git, you may have your own project on bitbucket and have the zend library, etc. as a submodule in the seperate lib/-directory, like so:

YourProject/   <-- Your git working tree (via git init)
  public/
  libs/
    Zend/      <-- a git submodule
  application/

The command to add a submodule is git submodule add http://zf-repo libs/Zend. You can then seperately update and track the zend framework, because your main git working tree will also reference a specific version of the Zend Framework Library.



回答3:

Once you forked the ZendSkeletonApplication, you can push the fork to a private repository in your Bitbucket account or on your own servers/network.

You can deploy your own packages/modules on Bitbucket and even require them via composer if you want, but as @Lars stated, it's possible to simply use a git submodule if that's easier for you.

There's also a great presentation by Niels Aderman about advanced composer usage if you're not familiar with the tool.