Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 672349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:28:31+00:00 2026-05-14T00:28:31+00:00

I am integrating Zend Framework into an existing application. I want to switch the

  • 0

I am integrating Zend Framework into an existing application. I want to switch the application over to Zend’s autoloading mechanism to replace dozens of include() statements.

I have a specific requirement for the autoloading mechanism, though. Allow me to elaborate.

The existing application uses a core library (independent from ZF), for example:

/Core/Library/authentication.php
/Core/Library/translation.php
/Core/Library/messages.php

this core library is to remain untouched at all times and serves a number of applications. The library contains classes like

class ancestor_authentication { ... }
class ancestor_translation { ... }
class ancestor_messages { ... }

in the application, there is also a Library directory:

/App/Library/authentication.php
/App/Library/translation.php
/App/Library/messages.php

these includes extend the ancestor classes and are the ones that actually get instantiated in the application.

class authentication extends ancestor_authentication { }
class translation extends ancestor_translation { }
class messages extends ancestor_messages { }

usually, these class definitions are empty. They simply extend their ancestors and provide the class name to instantiate.

$authentication = new authentication();

The purpose of this solution is to be able to easily customize aspects of the application without having to patch the core libraries.

Now, the autoloader I need would have to be aware of this structure. When an object of the class authentication is requested, the autoloader would have to:

1. load  /Core/Library/authentication.php
2. load  /App/Library/authentication.php

My current approach would be creating a custom function, and binding that to Zend_Loader_Autoloader for a specific namespace prefix.

  • Is there already a way to do this in Zend that I am overlooking? The accepted answer in this question kind of implies there is, but that may be just a bad choice of wording.

  • Are there extensions to the Zend Autoloader that do this?

  • Can you – I am new to ZF – think of an elegant way, conforming with the spirit of the framework, of extending the Autoloader with this functionality? I’m not necessary looking for a ready-made implementation, some pointers (This should be an extension to the xyz method that you would call like this…) would already be enough.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:28:32+00:00Added an answer on May 14, 2026 at 12:28 am

    To extend what Gordon already pointed out, I’d create my own autoloader class that implements Zend_Loader_Autoloader_Interface and push that onto the Zend_Loader_Autoloader-stack.

    class My_Autoloader implements Zend_Loader_Autoloader_Interface 
    {
        public function autoload($class) 
        {
            // add your logic to find the required classes in here
        }
    }
    
    $autoloader = Zend_Loader_Autoloader::getInstance();
    // pushAutoloader() or unshiftAutoloader() depending on where 
    // you'd like to put your autoloader on the stack
    // note that we leave the $namespace parameter empty
    // as your classes don't share a common namespace
    $autoloader->pushAutoloader(new My_Autoloader(), '');
    

    I wouldn’t go with the Zend_Loader approach as, even though not deprecated yet, the new Zend_Loader_Autoloader seems to be best practice currently.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using DynamicGuys doctrine2 integration into zend framework(https://github.com/dynamicguy/zf1doctrine2). It works, but if i want
I'm looking at integrating an ESB into an existing Java/Maven web based product. Specifically,
I am working on integrating affiliate sales into few existing sites. We are using
I am integrating third party code into the web application I am writing in
What is the best way to integrate an external script into the Zend Framework?
I have several question about integrating integrating Doctrine 2.2 & Zend framework. I know
I am integrating tinyMCE editor along with a system am developing with Zend Framework.
I am integrating Zend Framework and Doctrine 2. The question is, in my controllers
I am integrating Zend Framework and Doctrine 2 , and I am discovering the
Integrating few controls of WPF into windows forms application has increased the memory usage

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.