PHPackages                             hugsbrugs/php-screenshot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hugsbrugs/php-screenshot

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hugsbrugs/php-screenshot
========================

PHP Screenshot Utilities

1231PHP

Since Jan 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/hugsbrugs/php-screenshot)[ Packagist](https://packagist.org/packages/hugsbrugs/php-screenshot)[ RSS](/packages/hugsbrugs-php-screenshot/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-screenshot
==============

[](#php-screenshot)

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](https://camo.githubusercontent.com/85f75944e06a5cbde53fc04bd6efa994cd16fb97191153f3e4d23c1357d1c0e5/68747470733a2f2f7472617669732d63692e6f72672f6875677362727567732f7068702d73637265656e73686f742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hugsbrugs/php-screenshot)[![Coverage Status](https://camo.githubusercontent.com/6e7b4427607fa620b2e58ed6ef3b9f5ceee30d941086f1798ae86df26bea645e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6875677362727567732f7068702d73637265656e73686f742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/hugsbrugs/php-screenshot?branch=master)

Notes
-----

[](#notes)

Currently 3 providers are available : [Manet](https://github.com/vbauer/manet)[Apercite](http://www.apercite.fr/)[PagePeeker](http://pagepeeker.com/)

You're welcome to suggest others providers.

Install
-------

[](#install)

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');
define('HUG_SCREENSHOT_CACHE', 'P1W');
```

HUG\_SCREENSHOT\_SAVE\_PATH should be writable by webserver user

HUG\_SCREENSHOT\_PROVIDERS is a json file like following

```
{
	"1": {
		"provider":"Manet",
		"basic_auth_user":"USERNAME",
		"basic_auth_pass":"PASSWORD",
		"scheme":"http OR https",
		"host":"HOSTNAME_OR_IP",
		"port":"PORT",
		"params":{
			"engine":"slimerjs|phantomjs",
			"format":"jpg|png|gif",
			"width":"1024",
			"delay":"3000",
			"quality":"0.9"
		}
	},
	"2":{
		"provider":"Apercite"
	},
	"3":{
		"provider":"PagePeeker",
		"code":"YOUR_CODE",
		"entrypoint":"free",
		"size":"x",
		"refresh":"",
		"wait":""
	}
}
```

Please referer to each provider documentation for option details.

Usage
-----

[](#usage)

```
$Screenshot = new Screenshot();

$url = 'https://hugo.maugey.fr';
$widths = ['1024', '768', '480'];
$screenshot = $Screenshot->shot($url, $widths);
error_log(print_r($screenshot, true));
```

with outputs

```
[status] => success
[message] =>
[images] => Array
    (
        [1024] => hugo.maugey.fr-1024xauto-1492020456.jpg
        [768] => hugo.maugey.fr-768xauto-1492020467.jpg
        [480] => hugo.maugey.fr-480xauto-1492020475.jpg
    )
[details] => Array
```

Screenshot filenames are generated with following conventions :

- URL
- width x height
- timestamp

Unit Tests
----------

[](#unit-tests)

```
phpunit --bootstrap vendor/autoload.php tests

```

Author
------

[](#author)

Hugo Maugey [visit my website ;)](https://hugo.maugey.fr)

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cc04033020c3e5219ac30edf7d7362952e88ea64a0de2f41b89559f849f09901?d=identicon)[hugsbrugs](/maintainers/hugsbrugs)

---

Top Contributors

[![hugsbrugs](https://avatars.githubusercontent.com/u/4385090?v=4)](https://github.com/hugsbrugs "hugsbrugs (8 commits)")

---

Tags

phpscreenshot

### Embed Badge

![Health badge](/badges/hugsbrugs-php-screenshot/health.svg)

```
[![Health](https://phpackages.com/badges/hugsbrugs-php-screenshot/health.svg)](https://phpackages.com/packages/hugsbrugs-php-screenshot)
```

###  Alternatives

[components/mathjs

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with different data types like numbers, big numbers, complex numbers, fractions, units, and matrices.

15.0k3.9k](/packages/components-mathjs)[phpskills/phpskills

Implementation of Microsoft's TrueSkill matchmaking system for PHP

773.8k](/packages/phpskills-phpskills)[chinayin/ip2region-core

Ip2region (2.0 - xdb) is a offline IP address manager framework and locator with ten microsecond searching performance. xdb engine implementation for many programming languages

2219.6k2](/packages/chinayin-ip2region-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
