nikocraft's avatar

will laravels packages also work on Lumen?

I'm interested in Purifier package which is used to clean up the input from the user, and wonder if I can use it on Lumen

https://github.com/mewebstudio/Purifier

What is everyone else using to sanitize input in Lumen?

0 likes
5 replies
jlrdw's avatar

I would backup everything first and perhaps give it a try. If it doesn't work just restore your backup. But there is also html purifier: http://htmlpurifier.org/

nikocraft's avatar

there is also a postman that hacker can use to post something to an endpoint and then htmlpurifier is of no use :)

jlrdw's avatar

You could just strip tags:

    public static function fixValue($rvalue) {
        $rvalue = empty($rvalue) && !is_numeric($rvalue) ? NULL : trim(strip_tags($rvalue));
        return $rvalue;
    }

But is there a bug in htmlpurifier, can you explain?

nikocraft's avatar

sorry name of that package confused me, I thought it would execute on the client and not on server, actually link I post first is wrapper for the htmlpurifier! :)

Lorceroth's avatar

Scrolled through the service provider of the Purifier package you mentioned and it seems like it's wired up for Lumen as well :P

https://github.com/mewebstudio/Purifier/blob/master/src/PurifierServiceProvider.php#L32

if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
    $this->publishes([$source => config_path('purifier.php')]);
} elseif ($this->app instanceof LumenApplication) {
    $this->app->configure('purifier');
}

Please or to participate in this conversation.