Home > PHP > New autoloading with Zend Framework 1.8

New autoloading with Zend Framework 1.8

I love the fact that you can autoload classes using the ZF. I was a little shocked at the depreciation errors when I updated to ZF 1.8. Apparently, there is a new way to use the autoload class. It took a little reading but I came up with this solution. Let me know what you think!

/*
 * Set up Zend loader
 */
require_once 'Zend/Loader/Autoloader.php';

$autoloader = Zend_Loader_Autoloader::getInstance();

/*
 * Register Cisc Classes
 */
$autoloader->registerNamespace('Cisc_');

The registerNamespace function registers my own classes.

Categories: PHP Tags:
  1. Stuart
    September 15, 2009 at 9:31 am | #1

    Hi Wes,

    Where should this snippet go?

    • Wes
      September 16, 2009 at 7:46 pm | #2

      I usually put it in a main file and reference that file from all the other pages.

  1. No trackbacks yet.