Fixes your uploaded SVG files before validating through the Laravel validator
digifactory/laravel-svg-fixer-middleware is a Laravel package for fixes your uploaded svg files before validating through the laravel validator.
It currently has 5 GitHub stars and 34.511 downloads on Packagist (latest version v5.0.1).
Install it with composer require digifactory/laravel-svg-fixer-middleware.
Discover more Laravel packages by digifactory
or browse all Laravel packages to compare alternatives.
Last updated
The Laravel image validator doesn't validate an SVG if the file is missing the XML declaration on top. This middleware automatically fixes these incorrect SVG files by adding the XML declaration before it is validated.
You can install the package via composer:
composer require digifactory/laravel-svg-fixer-middleware
Simply register the SvgFixerMiddleware class in your middleware stack.
// app/Http/Kernel.php
class Kernel extends HttpKernel
{
protected $middleware = [
// ...
\DigiFactory\SvgFixer\SvgFixerMiddleware::class,
];
// ...
}
The middleware only runs for POST requests containing SVG files.
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.