I am trying to add a View Helpers file in my App Directory with a class called HoaTags. I'm using namespaces and the Phalconphp class loader, however it's having a problem in autoloading the class when it's called.
Here's my app/HoaTags/HoaTags.php file:
<?php
namespace HoaView\HoaTags;
use Phalcon\Tag;
class HoaTags extends Tag
{
/* Helpers code here */
}
?>
Here is my loader.php file snippet
$namespaces = array(
'HoaView\Models' => $config->application->modelsDir,
'HoaView\Controllers' => $config->application->controllersDir,
'HoaView\Forms' => $config->application->formsDir,
'HoaView\HoaTags' => $config->application->helpersDir,
'HoaView' => $config->application->libraryDir,
);
$loader->registerNamespaces($namespaces);
$loader->register();
And finally, my services.php file where I am adding it to the $di:
$di->set('hoatags', function () {
return new HoaTags();
});
The problem occurs in the views when I try to call or instantiate a new HoaTags object. The error says that the class is not found: Fatal error: Class 'HoaView\HoaTags' not found ...
I've been over this many times trying to find what's not loading correctly. Any help is greatly appreciated by the Phalconphp community! Thanks!