当前位置: 动力学知识库 > 问答 > 编程问答 >

Zend Framework library best practices?

问题描述:

Is it best to have each application with its own copy of the ZF library code, or have the code in one area on the drive and just make sure it's on the include path? Having each app with its own copy seems like the best way to avoid any deployment issues (for instance, developing on Windows and deploying on Linux).

I am using Netbeans as my IDE and I notice that it does NOT copy the files over (library folder is empty when it should have the Zend folder with all the subfolders under that) when a new Zend project is created.

网友答案:

And if you want to upgrade to a newer version, you 'd have to do it on all installs.. ;)

I use one codebase for the framework and all apps reference it from there.

网友答案:

I have a common folder, which contains all the Zend Framework versions which are being used by all the different apps. Each app references these. So we have a directory structure like so:

htdocs/common/zend-1.10.1/
htdocs/common/zend-1.10.2/
htdocs/apps/app1
htdocs/apps/app2

If however we are on a production environment - for instance app1 has been deployed to it's own server, then we simply make app1 the root/htdocs folder (so upload all the stuff in the app1 folder into the server's htdocs). We then also create a common folder and upload any libraries that particular app is using.

This works as we do define(COMMON_PATH, $_SERVER['DOCUMENT_ROOT'].'/common') as the common folder, so no extra configuration is needed for the different directory structures. We can then use this in our application.ini by zendpathorwhatever = COMMON_PATH "/zend-1.10.2

This way we only ever have one copy of each zend framework version we use, and for production we only need to upload what we need.

Each application always has it's own library folder, as this is used for per application requirements. If it turns out all applications are using a library, then we stick it in the common folder.

Overall it's easy to manage, and has turned out to be quite a elegant solution when using it with SVN Externals.

分享给朋友:
您可能感兴趣的文章:
随机阅读: