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.

Multiple module saying "IndexController handler class cannot be loaded"

Hi im new to phalcon, and im trying to create multiple modules in phalcon php im currently stuck telling me that "IndexController handler class cannot be loaded" and follwing this documentation

i uploaded the files on github. here is the link to the file.

Your controllers need to be namespaced.

In Module.php you register namespaces for the frontend controllers as Multiple\Frontend\Controllers, which means that at the top of your IndexController you need

multiple/apps/frontend/controller/IndexController.php

<?php
namespace Multiple\Frontend\Controllers;

All files you define in registernamespaces need to be namespaced. When you want to call your models from your controllers you will need to namespace those as well


<?php

$users = \Multiple\Frontend\Models\Users::find();

thanks for the quick reply but it's still not working when i access

localhost/hmvc/ -> this would return "IndexController handler class cannot be loaded" localhost/hmvc/frontend -> this would return "FrontendController handler class cannot be loaded"

I have currently 2 modules set up though, frontend and backend module. thanks!



6.5k
Accepted
answer

Everything needs to be inside a namespace. I gave the example of the frontend controller but it doesn't stop there.

Check the full example at https://github.com/phalcon/mvc/tree/master/multiple

thanks I got the idea. :)