Weave 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 Browsershot

Laravel Browsershot Laravel Package

verumconsilium/laravel-browsershot

A Laravel wrapper for Browsershot that turns HTML into PDFs and screenshots via headless Chrome. Configure named instances, set global options, and capture pages with a clean facade and fluent API.

View on GitHub
Deep Wiki
Context7

Browsershot wrapper for Laravel 5

Frequently asked questions about Laravel Browsershot
How do I install verumconsilium/laravel-browsershot?
Install it with Composer using composer require verumconsilium/laravel-browsershot. On Laravel versions with package auto-discovery the service provider and facade alias are registered for you; on older Laravel 5 releases you add them to config/app.php manually. Because the package is a thin wrapper, headless Chrome plus Node and Puppeteer still have to be available on the machine that runs the capture.
Which Laravel versions does laravel-browsershot support?
The package describes itself as a Browsershot wrapper for Laravel 5, so that is the compatibility window it explicitly claims. If you are evaluating it for Laravel 10, 11, or 12, read the composer.json constraints and the repository activity before pinning it, since the description alone does not promise support for newer releases. In practice the wrapper delegates almost all work to spatie/browsershot, so the underlying PHP and Laravel constraints are what decide whether it installs.
How do I generate a PDF from HTML with laravel-browsershot?
Resolve the facade, select a configured instance, and pass either raw HTML or a URL through the fluent Browsershot API, then call the save method with the destination path for the PDF. Because the wrapper forwards calls to Browsershot, options such as page format, margins, and headers are the same ones documented by the underlying package. This makes it easy to render an invoice or report view to PDF directly from a controller or a queued job.
How do I take a screenshot of a page with laravel-browsershot?
Point the instance at the URL you want to capture, optionally set the viewport or window size through the fluent options, and save the result to an image path. The same facade and instance configuration used for PDF generation applies to screenshots, so you do not need a separate setup. Remember that the target URL must be reachable from the server running headless Chrome, not just from your browser.
How do I configure multiple Chrome instances or binaries?
The package supports named instances, which lets you define separate configurations, for example different Chrome or Node binary paths, per environment or per use case. You publish and edit the package config file, declare each instance by name, and then select that name through the facade before running a capture. This is useful when a queue worker, a container, and a local machine each need a different binary path.
How do I set global options for every Browsershot call?
The package lets you define global options that are applied to every instance, so defaults like a Chrome path, no-sandbox flags, or common PDF settings only need to be written once. Per-call fluent options typically layer on top of those defaults for the specific page you are rendering. Keep the global set small and portable, since options like a hard-coded binary path will break when the same code runs in a different container.
What does getTempFilePath do in laravel-browsershot?
Version 1.1.1 added a getTempFilePath method that exposes the resolved path of the temporary artifact the package produced. It is handy when a downstream API needs a filesystem string instead of an upload or stream, for example Storage::path, Intervention Image, Imagick, PhpSpreadsheet, a Symfony Process argument, or response()->download. Treat it as a local-only contract: a path string is only meaningful for local or local-tmp disks, and you should confirm with the package docs how long the file is guaranteed to exist before you store that path anywhere.
Do I need Node.js, Puppeteer, and Chrome installed to use this package?
Yes. This package is a Laravel wrapper around Browsershot, which drives a headless Chromium through Puppeteer, so Node and a Chromium binary must be installed and reachable on the host that performs the capture. The wrapper does not bundle or download a browser for you. In Docker or CI you typically install Node and Chromium in the image and then point the instance configuration at those binary paths.
Can I use laravel-browsershot inside queued jobs or under Laravel Octane?
You can run captures from a queued job, which is often the right choice because rendering a PDF or screenshot is slow and memory heavy. Be careful with temp paths: under Octane, queue workers, and multi-container deployments, the temp directory is per process and per node, so a path resolved in one request is not addressable from a worker on another host. Generate and consume the artifact inside the same process, or move it to shared storage before handing the path to other code.
How do I test code that uses the laravel-browsershot facade?
Swap or fake the facade in your unit tests so no real Chrome process is spawned, and assert that the expected instance, URL, and options were passed through the fluent chain. Keep a small number of integration tests that do render real HTML to PDF or PNG, tagged so they can run only in an environment where Node and Chromium are installed. That split keeps your main suite fast while still catching breaking changes in the underlying Browsershot API.
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.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel