views:

52

answers:

2

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.

+1  A: 

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.

john
Fair point. How do you handle deployment issues then? Just change the code that references the path when it goes to another server? Or maybe you can use the... I forget the PHP term but the application.ini and have different settings pointing to the location?
Wayne M
Every application has a 'library' folder for uh, libraries. We also have a shared library folder on the server for things Zend or Doctrine. So with every deployment, we just symlink the Zend folder in the shared library into the app's local library folder. We use Capistrano for automated deployment, which makes things dirt simple.
Bryan M.
+1  A: 

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.

balupton