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.
The Cloudflare driver uses Cloudflare's Browser Rendering API to take screenshots. It does not require Node.js or a Chrome binary on your server, making it a great option for cloud-hosted or serverless Laravel applications.
.env file:LARAVEL_SCREENSHOT_DRIVER=cloudflare
CLOUDFLARE_API_TOKEN=your-api-token
CLOUDFLARE_ACCOUNT_ID=your-account-id
No other dependencies are required. The Cloudflare driver uses Laravel's built-in HTTP client.
The Cloudflare driver supports all the core screenshot features:
You can use the Cloudflare driver for a specific screenshot while keeping Browsershot as the default:
use Spatie\LaravelScreenshot\Facades\Screenshot;
Screenshot::url('https://example.com')
->driver('cloudflare')
->save('screenshot.png');
Be aware of Cloudflare's rate limits for the Browser Rendering API. The free plan includes:
For production use, consider a paid plan with higher limits.
withBrowsershot() method has no effect when using the Cloudflare driverHow can I help you explore Laravel packages today?