Zend Framework 1 for Composer
This is a maintained mirror of ZF1 for use with Packagist. You can find the original ZF1 readme in README.txt, (*1)
Why maintain a mirror? Because we love Github & Composer - it's just a better experience than the official Subversion Repository., (*2)
Installation
To install, add the following to composer.json
at the root of your project:, (*3)
{
"require": {
"breerly/zf1": "1.11.*"
}
}
Then download composer and install the dependencies., (*4)
curl -s http://getcomposer.org/installer | php
php composer.phar install
Using ZF Components standalone
Require the autoloader and you're good to go., (*5)
<?php
require 'vendor/autoload.php';
Zend_Debug::dump('it worked!');
Setting up an entire Zend Framework Project
Use ZF's cli to setup your project., (*6)
php vendor/bin/zf.php --help
php vendor/bin/zf.php create project . myproject
Now install vendors., (*7)
curl -s http://getcomposer.org/installer | php
php composer.phar install
You'll want to add the vendors folder to your .gitignore
, (*8)
echo vendors >> .gitignore
Then at the top of public/index.php
require the autoloader., (*9)
<?php
require_once __DIR__ . '/../vendor/autoload.php';
// ...
You're good to go!, (*10)
Bonus: Optimizing Autoload
If you do not plan on using ZF's library convention for autoloading and instead plan on using Composer across the board, you should disable Zend_Loader_Autoloader
by adding this line in public/index.php
before the application is bootstrapped., (*11)
<?php
// ...
spl_autoload_unregister(array('Zend_Loader_Autoloader','autoload'));
$application->bootstrap()->run();