jacksleight / laravel-raster
Rasterise views and components to images by simply adding a directive and fetching the URL.
Fund package maintenance!
1.0.0
2026-11-02 09:49 UTC
Requires
- php: ^8.2
- laravel/framework: ^12.0|^13.0
- spatie/browsershot: ^5.0.5
Requires (Dev)
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.5
- phpstan/phpstan: ^1.12
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Rasterise views and components to images by simply adding a directive and fetching the URL. Automatic routing, scaling, caching, protection and preview mode. Zero configuration (unless you need it).
Example
Add the @raster directive to a view:
{{-- resources/views/blog/hero.blade.php --}} @raster( width: 1000, data: fn ($post) => [ 'post' => Post::find((int) $post), ], ) <div> <svg>...</svg> <h1>{{ $post->title }}</h1> <p>{{ $post->date }}</p> </div>
Then fetch the URL with the raster() helper:
{{-- resources/views/blog/show.blade.php --}} @push('head') <meta property="og:image" content="{{ raster('blog.hero', ['post' => $post]) }}"> @endpush
Documentation
Sponsoring
This package is completely free to use. However fixing bugs, adding features and helping users takes time and effort. If you find this package useful and would like to support its development any contribution would be greatly appreciated. Thanks! 🙂