Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Module definition path '../apps/frontend/FrontendModule.php' does not exist

My index file looks as below;

use Phalcon\Mvc\Router,

$di = new FactoryDefault();

//Specify routes for modules
$di->set('router', function () {

$router = new Router();



$router->add("/partner", array(
    'module'     => 'backend',
    'controller' => 'index',
    'action'     => 'index',

return $router;
try {

//Create an application
$application = new Application($di);

// Register the installed modules
        'frontend' => array(
            'className' => 'Project\Frontend\FrontendModule',
            'path'      => '../apps/frontend/FrontendModule.php',
        'backend'  => array(
            'className' => 'Project\backend\BackendModule',
            'path'      => '../apps/backend/BackendModule.php',

//Handle the request
echo $application->handle()->getContent();

} catch(\Exception $e){
echo $e->getMessage();


try to use _ DIR _.'/../apps/frontend/FrontendModule.php',

edited Feb '15

Thanks alot. Your are a star. This Does.

However I get to this error;

Project\Frontend\Controllers\IndexController handler class cannot be loaded

My controller has the namespace as below. <?php namespace Project\Frontend\Controllers;

I have registered the namespace in module class as shown; public function registerAutoloaders() { $loader = new Loader(); $loader->registerNamespaces( array( 'Project\Frontend\Controllers' => '../apps/frontend/controllers/', 'Project\Frontend\Models' => '../apps/frontend/models/', ) ); $loader->register(); }

Is there something I should do in the index file for this to work? thanks


Again, _ DIR _ maybe ? :)

public function registerAutoloaders() { 

  $loader = new Loader(); 
  $loader->registerNamespaces( array( 
      'Project\Frontend\Controllers' => __DIR__.'/../apps/frontend/controllers/', // IF THIS IS THE CORRECT PATH !
      'Project\Frontend\Models' => __DIR__'/../apps/frontend/models/', 
  ) );


I had added the directory path but doesn't seem to remove the error


Can you provide us your directory structure ? You can do that quickly by using the tree command in your project folder


├───app │ ├───backend │ │ ├───controllers │ │ ├───models │ │ └───views │ │ ├───index │ │ └───layouts │ ├───cache │ ├───config │ ├───frontend │ ├───controllers │ ├───models │ └───views │ ├───index │ └───layouts │
└───public ├───css ├───files ├───img ├───js └───temp

On Wed, Feb 18, 2015 at 3:11 PM, Calin Rada [email protected] wrote:


RTry this

public function registerAutoloaders() { 

  $loader = new Loader(); 
  $loader->registerNamespaces( array( 
      'Project\Frontend\Controllers' => __DIR__.'/controllers/',
      'Project\Frontend\Models' => __DIR__'/models/', 
  ) );

edited Feb '15

I have managed to eliminate that error by removing the loader register class function content from the module class and registering all namespace within the index file.

now working on this error; - Service 'view' was not found in the dependency injection container. if you have a quick fix you can shot it my way:-)