Configuration | laravel-screenshot | Spatie

 SPATIE

  Laravel Screenshot
=====================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-screenshot](https://spatie.be/docs/laravel-screenshot/v1)  Drivers  Configuration

 Version   v1

 Other versions for crawler [v1](https://spatie.be/docs/laravel-screenshot/v1)

  Configuration
- [ Introduction ](https://spatie.be/docs/laravel-screenshot/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-screenshot/v1/support-us)
- [ Requirements ](https://spatie.be/docs/laravel-screenshot/v1/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-screenshot/v1/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-screenshot/v1/questions-issues)
- [ Changelog ](https://spatie.be/docs/laravel-screenshot/v1/changelog)
- [ About us ](https://spatie.be/docs/laravel-screenshot/v1/about-us)

Basic usage
-----------

- [ Taking screenshots ](https://spatie.be/docs/laravel-screenshot/v1/basic-usage/taking-screenshots)
- [ Customizing screenshots ](https://spatie.be/docs/laravel-screenshot/v1/basic-usage/customizing-screenshots)
- [ Saving screenshots to disks ](https://spatie.be/docs/laravel-screenshot/v1/basic-usage/saving-screenshots-to-disks)
- [ Queued screenshot generation ](https://spatie.be/docs/laravel-screenshot/v1/basic-usage/queued-screenshot-generation)
- [ Testing screenshots ](https://spatie.be/docs/laravel-screenshot/v1/basic-usage/testing-screenshots)

Drivers
-------

- [ Configuration ](https://spatie.be/docs/laravel-screenshot/v1/drivers/configuration)
- [ Customizing Browsershot ](https://spatie.be/docs/laravel-screenshot/v1/drivers/customizing-browsershot)
- [ Using the Cloudflare driver ](https://spatie.be/docs/laravel-screenshot/v1/drivers/using-the-cloudflare-driver)
- [ Custom drivers ](https://spatie.be/docs/laravel-screenshot/v1/drivers/custom-drivers)

Advanced usage
--------------

- [ Extending with macros ](https://spatie.be/docs/laravel-screenshot/v1/advanced-usage/extending-with-macros)

 Configuration
=============

###  On this page

1. [ Switching drivers per screenshot ](#content-switching-drivers-per-screenshot)
2. [ Using a custom driver instance ](#content-using-a-custom-driver-instance)

This package supports multiple screenshot drivers. You can set the default driver via the `LARAVEL_SCREENSHOT_DRIVER` environment variable:

```
LARAVEL_SCREENSHOT_DRIVER=browsershot
```

Or in the config file:

```
// config/laravel-screenshot.php

return [
    'driver' => 'browsershot', // or 'cloudflare'
    // ...
];
```

Switching drivers per screenshot
--------------------------------------------------------------------------------------------------------------------------------------------------------

You can switch drivers for a specific screenshot using the `driver()` method:

```
use Spatie\LaravelScreenshot\Facades\Screenshot;

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

Using a custom driver instance
--------------------------------------------------------------------------------------------------------------------------------------------------

You can also pass a driver instance directly:

```
use Spatie\LaravelScreenshot\Drivers\BrowsershotDriver;
use Spatie\LaravelScreenshot\Facades\Screenshot;

$driver = new BrowsershotDriver([
    'chrome_path' => '/usr/bin/google-chrome',
]);

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

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
