views:

136

answers:

5

Copying Zenf Framework everywhere is a nightmare, so I had an idea, thas deployment would be faster if whole framework would ba just a zip file. Is there a way to do that? Would it be very inefficient?

+2  A: 

You really have to deploy it only once per server, so it's not that much of a nightmare.

But to answer your question: if you mean that you can just include a single ZIP file, then no. To ease the pain of deployment, however, you can upload the ZF as a zip file to the server and then extract it on the remote machine. This is significantly faster than uploading a gazillion files individually.

Edit: Actually, you could probably implement your own version of a Zend_Loader that knows how to handle zip files. I highly doubt that it would perform reasonably, though. It would most likely cause more problems than it solves.

n3rd
+2  A: 

There is, as of 5.3 (though it could also be installed as a PECL module) PHAR files - http://pecl.php.net/phar & http://www.php.net/phar. However, running something as large as the entire ZF framework, where much of it would go unused most of the time, would be overkill. I think it's likely that when PHP5.3 is released, then significant parts of it would be also released as .PHAR files for use.

Until then, no. Copying it around is however, just a one-time deal though. You could also just download the original .tgz file and unzip it on the server.

Alister Bulman
A: 

I think you still need to unpack it, but it doesn't have to be copied into each project. Let's say you have a directory structure like so:

/htdocs
    /library
        /Zend
    /Project1
        [...]
        /public
            index.php
    /Project2
        [...]
        /public
            index.php

Then just edit the include path in index.php for Zend_Framework from ../library to:

../../library
PatrikAkerstrand
A: 

If you're working on a Unix based environment, adding a symbolic link to the Zend folder under your project's library folder would also work:

% cd /your/project/library
% ln -s /path/to/ZendFramework/library/Zend .
Bryan M.
A: 

You might use the PHAR[1] extension to manage this :) The PHAR extension allows you to use something like:

include 'phar:///path/to/zend-latest.tgz/file.php';

PS: PHAR can also handle .zip or .tgz files.
I hope it helps. Cheers.

1: http://php.net/phar

I know i can do this, probably with zip:// as well. The question was: can I put an archive on the include_path?
hegemon