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

Phalcon\Loader can't load class from phar?

$loader = new Phalcon\Loader();
$loader->registerDirs( array( 'phar:///path/to/phar/predis_0.8.5.phar' ) );

that can't load \Predis\Client but the Client.php file in predis_0.8.5.phar package /Predis



98.9k

I don't think you need an autoloader, I think only requiring the file would make the classes there available for the aplication:

require "path/to/phar/predis_0.8.5.phar";


98.9k
Accepted
answer

Also, it seems that library has its own autoloader:

require 'Predis/Autoloader.php';

Predis\Autoloader::register();

https://github.com/nrk/predis#loading-the-library