Download the PHP package eduardoribeirodev/browsershot without Composer

On this page you can find all versions of the php package eduardoribeirodev/browsershot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package browsershot

Laravel Browsershot Service

A fluent Laravel wrapper for Spatie's Browsershot package that simplifies generating screenshots and PDFs from HTML content or Blade views.

Features

Installation

Prerequisites

This package requires Puppeteer/Chromium to be installed. Follow Spatie's Browsershot installation guide for your environment.

Configuration

Add the Chrome path to your config/services.php:

Set the path in your .env file:

Basic Usage

Generate PDF from Blade View

Generate Screenshot from HTML

Download PDF in a Controller

API Reference

Initialization

make(View|string $content, array $data = []): self

Creates a new instance. Accepts a Blade View object, a view name string, a URL, or a raw HTML string.


Size & Viewport

size(int $width, int $height, string $unit = 'px'): self

Sets the viewport/paper dimensions. Supported units: px, mm, cm, in.

center(int $x, int $y): self

Sets the clip origin. Must be combined with size().

clip(int $x, int $y, int $width, int $height): self

Shorthand for setting both center and size at once.

scale(float $scale): self

Sets the device scale factor for high-resolution output.

aspectRatio(string|float $ratio): self

Adjusts the current size to match a given aspect ratio. Must call size() first.


Paper Format Shortcuts

These methods set the viewport to a standard paper size (in mm). An optional $scale multiplier can be passed to format().

format(string $format, float $scale = 1): self

Named shortcuts (equivalent to calling format() with the matching name):

Method Dimensions (mm)
a0() 841 × 1189
a1() 594 × 841
a2() 420 × 594
a3() 297 × 420
a4() 210 × 297
a5() 148 × 210
a6() 105 × 148
letter() 216 × 279
legal() 216 × 356
tabloid() 279 × 432
ledger() 432 × 279

Orientation

landscape(bool $landscape = true): self

portrait(): self


Margins

margin(int $size, string $unit = 'mm'): self

Applies a uniform margin to all four sides.

margins(int $top, int $right, int $bottom, int $left, string $unit = 'mm'): self

Sets each margin individually in one call.

marginTop / marginRight / marginBottom / marginLeft

Fluent per-side setters.


Output Format

pdf(): self

png(): self

jpeg(): self

webp(): self

extension(string $extension): self

Sets the output file format. The named helpers are shorthands for extension().


PDF-Specific Options

pages(...$pages): self

Selects specific pages (or page ranges) to include in the PDF output.


Sandbox

noSandbox(bool $noSandbox = true): self

Disables Chrome's sandbox — required in most Docker/CI environments.


Advanced Customization

modifyBrowsershotUsing(Closure $callback): self

Provides direct access to the underlying Spatie\Browsershot\Browsershot instance for options not exposed by this wrapper.


Output Methods

generate(): string

Returns the raw binary content.

download(?string $fileName = null): StreamedResponse

Streams the file as a browser download. The correct extension is appended automatically if missing.

save(string $path, ?string $disk = null): bool

Saves to Laravel's filesystem. Uses the default disk when $disk is omitted.

toBase64(): string

Returns the content as a base64-encoded string.


HTML Structure Handling

The service automatically wraps partial HTML in a complete document structure:

Input Output
<h1>Title</h1> (fragment) Full document: DOCTYPE + <html> + <head> + <body>
<head>…</head><body>…</body> Wraps with DOCTYPE + <html>
<body>…</body> Adds DOCTYPE, <html>, and <head>
<!DOCTYPE html><html>…</html> Used as-is

Advanced Examples

A4 Invoice PDF

High-Resolution Social Media Image

Certificate with Clip Region

Thumbnail as Base64

Batch Report Generation

Custom Browsershot Options


Testing


Troubleshooting

Chrome/Chromium Not Found

Permission Issues in Docker

Memory Issues with Large PDFs


Performance Tips

  1. Cache generated content when possible
  2. Use queues for batch generation
  3. Optimize Blade views — minimize CSS/JS complexity
  4. Set appropriate sizes — don't generate larger than needed
  5. Choose the right format — JPEG is smaller than PNG for photographic content

License

This package is open-sourced software licensed under the MIT license.

Credits

Support

For issues, questions, or contributions, please visit the GitHub repository.


All versions of browsershot with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/browsershot Version ^5.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eduardoribeirodev/browsershot contains the following files

Loading the files please wait ...