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.

Fatal error: Call to undefined method Phalcon\Loader::registerPrefixes()

Hi all, I want to use the library HTMLPurifier. And I use command to create project default: phalcon create-project testabc I use the code for load HTMLPurifier :

$loader = new \Phalcon\Loader(); $loader->registerPrefixes([ 'HTMLPurifier' => LIBRARY_PATH.'/HTMLPurifier' ]); $loader->register();

But it error:

Fatal error: Call to undefined method Phalcon\Loader::registerPrefixes()

Please help me declared using HTMLPurifier.

I use phalcon version: 2.1.0

Loader of the Phalcon version 2.1 no longer supports registerPrefixes.

I strongly recommend to load it via composer as ezyang/htmlpurifier or other dependency manager.

edited Mar '16

If you dont use composer, just simply require

LIBRARY_PATH . '/HTMLPurifier.auto.php'

please guide me in detail

If you dont use composer, just simply require

``` LIBRARY_PATH . '/HTMLPurifier.auto.php' ```



6.9k
Accepted
answer

Forget Phalcon Loader and in your bootstrap file just add

require_once(LIBRARY_PATH . '/HTMLPurifier.auto.php');

which registers HTMLPurifier autoloader

THanks you so much

Why is that ?

If we want to use Phalcon Loader instead of composer one, we need it.

Loader of the Phalcon version 2.1 no longer supports registerPrefixes.

I strongly recommend to load it via composer as ezyang/htmlpurifier or other dependency manager.