Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Screenshot Laravel Package

spatie/laravel-screenshot

Driver-based Laravel package for taking web page screenshots with great defaults. Use Browsershot (Chromium) or Cloudflare Browser Rendering, customize viewport/format/quality, save to files, and easily fake/assert screenshots in tests.

View on GitHub
Deep Wiki
Context7

title: Taking screenshots weight: 1

This package can take screenshots of any URL or raw HTML.

Screenshotting a URL

The most common use case is taking a screenshot of a URL:

use Spatie\LaravelScreenshot\Facades\Screenshot;

Screenshot::url('https://example.com')->save('screenshot.png');

Screenshotting HTML

You can also take a screenshot from a string of HTML:

use Spatie\LaravelScreenshot\Facades\Screenshot;

Screenshot::html('<h1>Hello world!</h1>')->save('hello.png');

Using JavaScript

The JavaScript in your HTML will be executed when the screenshot is taken. You could use this to have a JavaScript charting library render a chart.

Here's a simple example. If you screenshot this HTML...

<div id="target"></div>

<script>
    document.getElementById('target').innerHTML = 'hello';
</script>

... using this code...

use Spatie\LaravelScreenshot\Facades\Screenshot;

Screenshot::html($html)->save('screenshot.png');

... the text hello will be visible in the screenshot.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport