We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Namespace autoloating

I've created a config item for autoloading namespaces:

   'additionalNamespaces' => array(
        'Voice' => __DIR__ . '/../../app/library/' . '/Voice',
        'Phalcon' => array(
            __DIR__ . '/../../app/library/' . '/Phalcon'
 * Load additional namespaces from the config if there any present
if(is_array($config->additionalNamespaces)) {


But it doesn't seem to take, can't you define namespaces in multiple directories?

The reason we are doing this is because we want to define our own components in the library dir under /phalcon before making a pull request for the incubator.


You must pass 'true' as second parameter of registerNamespaces to merge the existing directories to the new ones

$loader->registerNamespaces($config->additionalNamespaces, true);


@Phalcon maybe i'm missing something, but it still says:

Fatal error: Class 'Phalcon\Cache\Backend\Redis' not found in /private/var/www/voice/app/library/Voice/Cache.php on line 16 

Note: I am using v1.2.0 now


Multiples directories for a same prefix aren't supported, Is that you're looking for?