"handler class cannot be loaded"

Ok, so first context. I am a COMPLETE Phalcon n00b. This is my first application, and actually my first time using MVC with PHP at all.

I'm running on CentOS, php version 5.3.3, apache 2.2.15.

I used the phalcon devtools to create my project structure:

$ find . 

And all the stuff in app/config is the default except for me changing the MySQL credentials. I am more or less using Vokuro as an example/starting point. This is the beginning of my PatientintakeController.php:

namespace test\Controllers;

use Phalcon\Tag;
use Phalcon\Mvc\Controller;
use Phalcon\Mvc\Model\Criteria;
use Phalcon\Paginator\Adapter\Model as Paginator;
use test\Forms\PatientIntakeForm;
use test\Models\PatientIntake;

class PatientintakeController extends Controller {

When I try to go to http://URL.com/test/PatientIntake I get this "PatientintakeController handler class cannot be loaded"

What am I doing wrong? TIA!!


Not sure why newlines aren't showing up when I paste from terminal, it makes reading the output of find rather difficult 0_o

So here is a pastebin: http://pastebin.com/BDj21Hp7

I see that you use namespaces in your project. Good practise but requires more configuration.

Open your /app/config/loader.php and add something like this:

        'test\Controllers' => __DIR__ . '/../controllers/',
        'test\Models' => __DIR__ . '/../models/'
        /** and more if you need */

Namespace does not change prefix in URL, so if you have test namespace and http://URL.com points to /app/public your controller should be available at http://URL.com/PatientIntake


How do you get stuff inside the black box like that? here is what loader.php looks like now, still getting the error:


Owh. I remembered one more thing. You need set default namespace in Dispatcher.

$di->set('dispatcher', function() {
    $dispatcher = new Dispatcher();
    return $dispatcher;


The black box is done using three backticks and the script type, like ```php, then add your code, and then close it with a final ```

// like this JS version
var name = "jim";


// or this PHP version
$word = "this";
echo "like " . $word;

Check out the Help link to the upper right of the comment form for more fun.