After three years and over 80 million SVG-to-format conversions in production, we're thrilled to open-source LaraSVG — a modern Laravel package that makes SVG conversion effortless.
Why LaraSVG?
Converting SVGs to raster formats (PNG, PDF, EPS) in PHP has always been painful. Existing solutions are either outdated, tied to a single converter, or lack proper Laravel integration.
LaraSVG changes that with:
- Multi-provider architecture — Switch between Resvg, Inkscape, rsvg-convert, and CairoSVG without changing your code
- Fluent API — Clean, chainable methods that feel natural in Laravel
- Laravel Filesystem integration — Output to any disk (S3, local, etc.)
- Stdout streaming — Pipe output directly for HTTP responses
Quick Start
composer require laratusk/larasvg
php artisan larasvg:setupThe setup command auto-detects which converters are available on your system and configures the best one.
Usage
use Laratusk\Larasvg\Facades\SvgConverter;
// Simple conversion
SvgConverter::open('logo.svg')
->setFormat('png')
->setDimensions(1024, 1024)
->toFile('logo.png');
// Switch providers per call
SvgConverter::using('inkscape')
->open('diagram.svg')
->setFormat('pdf')
->toFile('diagram.pdf');
// Stream to response
return SvgConverter::open('chart.svg')
->setFormat('png')
->toStdout();What's Next
We're actively working on additional features including WebP output support, batch processing, and a queue-friendly async API. Star the repo on GitHub to stay updated!