Search by

jacksleight / laravel-raster

jacksleight

Rasterise views and components to images by simply adding a directive and fetching the URL.

Package info

github.com/jacksleight/laravel-raster

pkg:composer/jacksleight/laravel-raster

Fund package maintenance!

jacksleight

Statistics

Installs: 138

Dependents: 1

Suggesters: 0

Stars: 12

Open Issues: 0

1.0.0 2026-11-02 09:49 UTC

This package is auto-updated.

Last update: 2026-11-02 10:45:44 UTC


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

Laravel Raster 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! 🙂