ZendX_Application53 is a project mainly written in PHP, based on the BSD-3-Clause license.
Zend Framework 5.3 namespaced applications.
This library's primary goal is extending Zend_Application to use PHP 5.3 namespaces. To simplify autoloading, the directory structure has been changed to match the application namespaces directly. The resource autoloader has been removed and instead we just add namespaces to Zend_Loader_Autoloader.
ZendX_Application53 tries to make the process of setting up an application with 5.3 namespaces as simple as possible. The following should be done to a new (or existing) ZF application to make it a 5.3 application:
Zend_Application
with endXApplication53Application
(make sure the require is correct as well). See index.phpendXApplication53ApplicationBootstrap
ZF's module resource autoloader was inconsistent (Blog_IndexController vs Blog_Model_Article), but since we're now using a namespace autoloader, we don't have to worry about trying to figure out where the autoloader is trying to find things. In all cases, the namespaces match the directory structure (just replace '' with '/' and add '.php' to the end).
All of the files in your application directory should be namespaced. The application root (or the module directory if specified) will become the root namespace . The first level namespaces (e.g.
Blog
) are what will become your application's modules. Inside each module you should have 'Controller' and 'View' namespaces/directories and then any others that you need to add ('Model', 'Form', 'Validator', etc.)
The Core
module replaces default
as the default module since 'default' is a reserved word in PHP and cannot be used as a namespace.
To give an idea of what a controller will look like with namespaces, see the IndexController in the Core module.
The directory structure matches the namespacing directly with application
being the root folder (root folder can be changed by setting moduleDirectory in application config).
The directory structure for Zend_Application has been changed from
-application
-default
-controllers
IndexController.php
ErrorController.php
-views
-scripts
-index
index.phtml
action1.phtml
-module1
-..
to:
-application
-Core
-Controller
IndexController.php
ErrorController.php
-View
-scripts
-index
index.phtml
action1.phtml
Bootstrap.php
-Module1
-..
Bootstrap.php