Question

I'm having a problem getting the HTMLPurifier bundle to work. I installed is as so:

php artisan bundle:install Sanitizer

then I edited application/bundles.php

'sanitize' => array('auto' => true),

when I use it:

$clean_output = Sanitize::purify($bad_input);

I get an Unhandled Exception: Class 'Sanitize' not found

I also noticed that when I try: php artisan bundle:upgrade Sanitize, I get an error saying bundle not installed. What am I missing? Any help greatly appreciated.

Was it helpful?

Solution

This bundle has been setup very badly, especially with the different namings and casings. Generally a bundle uses a standard name across the board. What's happening here is that when you install the bundle it's actually installing it to bundles/laravel-htmlpurifier. What you've defined in your bundles.php file is expecting it to be installed at bundles/sanitize.

You have two options.

Option 1

Rename the laravel-htmlpurifier directory to sanitize.

Option 2

Set the location key in the bundles.php file.

'sanitize' => array('auto' => true, 'location' => 'laravel-htmlpurifier')

This should also resolve the upgrading problems you were having. You shouldn't really have to do this as it's normally the responsibility of the bundle author to ensure everything is named correctly and consistently.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top