How can/should Zend Framework 2 be included to a Git versioned project?

前端 未结 1 1757
一整个雨季
一整个雨季 2021-02-03 15:22

How should the version controlling of a Zend Framework 2 project be managed? Is there a best practice / \"standard approach\" for this? Is \"submodule\" the right keyword?

相关标签:
1条回答
  • 2021-02-03 15:57

    A Zend Framework 2 Project is usually a lightweight skeleton application with various installed modules, which usually are on separate dedicated repositories.

    The main repository isn't usually affected by many changes, so you can create a git repository (fork of ZendSkeletonApplication) for it. While the modules are more relevant and require some care, the skeleton application usually changes only in a couple details over the months.

    I can suggest following approach:

    1. create your first versions of the app-specific modules as git submodules in the modules/ directory of your skeleton application fork.
    2. work on the modules in the suggested way, by simply committing back to the original repositories and updating the git submodule references in the root repository.
    3. Once you have a fairly well working version (and have some confidence with composer and zf2 in general), you can convert them into composer packages by adding a composer.json file.
    4. Remove the git submodule of the converted zf2 module and use composer to import it instead. To do so, you will simply need to tell composer where the repository is located. This will make the module installable in seconds on any of your applications, helping you in re-using existing components. Re-using code you wrote for different projects becomes really easy from now on.
    5. tag and progressively stabilize dependencies and versions of your packages (because you will start to have your own private composer packages ecosystem)

    This is how I personally do it, and it has turned into a very nice development process. Each time a feature is shared, I simply move it to a new package and update the composer.json in the modules. Satis takes care of the rest, and all our live systems are very fast to upgrade.

    You may want to read some more advanced techniques and tips and tricks about composer once you are familiar with it.

    0 讨论(0)
提交回复
热议问题