« Return to Thread: Request for feedback: moving Zend.php to Zend/Zend.php

Re: Request for feedback: moving Zend.php to Zend/Zend.php

by Kevin McArthur-2 :: Rate this Message:

Reply to Author | View in Thread

Bill,

> The benefit of this change is to simplify integration of a Zend
> Framework tree in an application tree.  You could use svn externals, for
> instance.

This brings up the question on whether this is how we want to recommend the
deployment of the framework.

I'm not recommending externals as an ideal deployment method, as it has some
issues with backwards compatibility and accidental updates when not using a
tagged version. What I've been recommending is a pear-similar global setup
using the following structure.

[]> mkdir /usr/share/php/ZendFramework
[]> cd /usr/share/php/ZendFramework
[]> wget http://framework.zend.com/download/tgz
[]> tar zxf ZendFramework-0.X.0.tar.gz

which puts the Zend.php at
/usr/share/php/ZendFramework/ZendFramework-0.X.0/library

Then during bootstrap (or via .htaccess)

$fwVersion = '0.X.0';
$fwPath = '/usr/share/php/ZendFramework';
set_include_path(get_include_path() . PATH_SEPARATOR . $fwPath .
DIRECTORY_SEPARATOR . 'ZendFramework-'. $fwVersion . DIRECTORY_SEPARATOR .
'library' );
require_once('Zend.php');

Then setup __autoload

This gives somewhat fine-grained control on a per-site basis over the fw
version the site is targeting. It also makes for patching functionality
system-wide a little simpler. I'm not against the externals method, but I'm
not sure it should be the default to include it in a standard library/Zend
directory under the source tree.

This also raises the question of how to recommend package-management
deployment of the ZendFramework. The current thoughts seem to be that an
update, updates the files in the library, but that assumes perfect backwards
compatibility and could get really messy.

Thoughts?

> The disadvantage is that it does not follow the ZF convention that class
> names always match the physical location of the class file.  But this is
> the only class that needs to be an exception to this convention.

Sounds feasible, but then will you continue to ship the fw package with a
library directory or with only a Zend directory?

Kevin McArthur


----- Original Message -----
From: "Bill Karwin" <bill.k@...>
To: <fw-general@...>
Sent: Sunday, February 25, 2007 4:27 PM
Subject: [fw-general] Request for feedback: moving Zend.php to Zend/Zend.php


Please take a look at http://framework.zend.com/issues/browse/ZF-958

We propose to move Zend.php to <zf-home>/library/Zend/Zend.php.  The
class name would continue to be 'Zend', and we're not suggesting
changing any methods within the class.  Therefore no usage of this class
would change.

The only change in your application would be that you need to change
this:

  require_once 'Zend.php';

To this:

  require_once 'Zend/Zend.php';

Alternatively, you could add the 'Zend' directory to your include_path.

The benefit of this change is to simplify integration of a Zend
Framework tree in an application tree.  You could use svn externals, for
instance.

The disadvantage is that it does not follow the ZF convention that class
names always match the physical location of the class file.  But this is
the only class that needs to be an exception to this convention.

I volunteer to make this change.  I'll update other classes in the ZF
tree.  I'll write a note in the manual to tell users what they need to
do.  I'll write a docblock in Zend.php acknowledging that it is an
exception to the class-to-location convention.

If there are no strong objections, I'll make this change.

Regards,
Bill Karwin

 « Return to Thread: Request for feedback: moving Zend.php to Zend/Zend.php