We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

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.

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.8k

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.8k
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