There is no license information available for the latest version (dev-master) of this package.

PHP Screenshot Utilities

dev-master 2020-01-06 15:21 UTC

This package is auto-updated.

Last update: 2022-08-06 21:16:46 UTC


This librairy provides utilities function to ease screenshot generation with different providers in order to always get a fallback in case first provider fails to generate screenshot.

Build Status Coverage Status


Currently 3 providers are available : Manet Apercite PagePeeker

You're welcome to suggest others providers.


Install package with composer

composer require hugsbrugs/php-screenshot

In your PHP code, load library

require_once __DIR__ . '/../vendor/autoload.php';
use Hug\Screenshot\Screenshot as Screenshot;

You first have to define 3 constants

define('HUG_SCREENSHOT_SAVE_PATH', '/path/to/screenshots/');
define('HUG_SCREENSHOT_PROVIDERS', '/path/to/providers.json');

HUG_SCREENSHOT_SAVE_PATH should be writable by webserver user

HUG_SCREENSHOT_PROVIDERS is a json file like following

	"1": {
		"scheme":"http OR https",

Please referer to each provider documentation for option details.


$Screenshot = new Screenshot();

$url = '';
$widths = ['1024', '768', '480'];
$screenshot = $Screenshot->shot($url, $widths);
error_log(print_r($screenshot, true));

with outputs

[status] => success
[message] => 
[images] => Array
        [1024] =>
        [768] =>
        [480] =>
[details] => Array

Screenshot filenames are generated with following conventions :

  • URL
  • width x height
  • timestamp

Unit Tests

phpunit --bootstrap vendor/autoload.php tests


Hugo Maugey visit my website ;)