We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Autoloader in Zephir

Hi all,

I've been searching all over the forum and on Github's Zephir projects on how to implemente an autoloader on Zephir, but so far I haven't found anything.

This is what I am trying:

public function __construct(string host, int port = 2424)
{
        spl_autoload_register([this, "autoload"]);

        let this...
        ...
}

public function autoload(className)
{
        echo className;
        var resourceClass;
        let resourceClass = new {className}(this);      
        call_user_func_array([resourceClass, "run"], func_get_args());
}

Can someone point me in the right direction on how to achieve this?

Regards, Hugo.