2017 © Pedro Peláez
 

library webshotter

Make screnshots of webpages with phantomjs

image

hotrush/webshotter

Make screnshots of webpages with phantomjs

  • Wednesday, December 27, 2017
  • by hotrush
  • Repository
  • 2 Watchers
  • 8 Stars
  • 371 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 7 Versions
  • 4 % Grown

The README.md

Build Status Latest Version Software License Total Downloads, (*1)

Webshotter

Take website's screenshots with PHP/PhantomJS and save them to PNG, JPG or PDF., (*2)

Also you can take a look at simple microservice with lumen and this package - hotrush/Webshotter-microservice., (*3)

Changelog

0.1.6 - added waitForImages() and imagesLoadingTimeout, (*4)

0.1.5 - custom $templatePath fixed, thanks to mizansyed, (*5)

0.1.3 - added timeout property that allow to limit page load timeout (using onResourceTimeout phantomjs feature). If timeout reached TimeoutException will be thrown., (*6)

Installation

composer require hotrush/webshotter

Laravel installation

After installing package via composer add a service provider to your config/app.php, (*7)

// app/config/app.php

'providers' => [
    ...,
    hotrush\Webshotter\WebshotServiceProvider::class
];

Usage

$webshot = new hotrush\Webshotter\Webshot();
$jpg = $webshot
    ->setUrl('https://github.com')
    ->setWidth(1200)
    ->setHeight(800)
    ->setTimeout(5) // set timeout in seconds, 30 seconds default
    ->setFullPage(true) // set to true to get full page screenshot (width/height will be used for viewport only)
    ->waitForImages() // wait when all images will load
    ->setImagesLoadingTimeout() // images loading timeout, will failt if not loaded
    ->saveToPng('github', $path);

You can use saveToJpg, saveToPng or saveToPdf methods. This methods requires 2 parameters: file name (without extension) and target directory to save file. They all returns full path to saved file, (*8)

If you want to use you own PhantomJs executable - you can specify path to it via constructor., (*9)

new hotrush\Webshotter\Webshot('/path/to/phantomjs');

Example screenshot:, (*10)

example, (*11)

License

The MIT License (MIT). Please see License File for more information., (*12)

The Versions

27/12 2017

dev-master

9999999-dev https://github.com/hotrush/webshotter

Make screnshots of webpages with phantomjs

  Sources   Download

MIT

The Requires

 

The Development Requires

by rush

laravel lumen image pdf gd imagick phantomjs jpg screenshot webpage png webshot

27/12 2017

0.1.7

0.1.7.0 https://github.com/hotrush/webshotter

Make screnshots of webpages with phantomjs

  Sources   Download

MIT

The Requires

 

The Development Requires

by rush

laravel lumen image pdf gd imagick phantomjs jpg screenshot webpage png webshot

16/05 2016

0.1.4

0.1.4.0 https://github.com/hotrush/webshotter

Make screnshots of webpages with phantomjs

  Sources   Download

MIT

The Requires

 

The Development Requires

by rush

laravel lumen image pdf gd imagick phantomjs jpg screenshot webpage png webshot

11/02 2016

0.1.3

0.1.3.0 https://github.com/hotrush/webshotter

Make screnshots of webpages with phantomjs

  Sources   Download

MIT

The Requires

 

The Development Requires

by rush

laravel lumen image pdf gd imagick phantomjs jpg screenshot webpage png webshot

03/02 2016

0.1.2

0.1.2.0 https://github.com/hotrush/webshotter

Make screnshots of webpages with phantomjs

  Sources   Download

MIT

The Requires

 

The Development Requires

by rush

laravel lumen image pdf gd imagick phantomjs jpg screenshot webpage png webshot

05/01 2016

0.1.1

0.1.1.0 https://github.com/hotrush/webshotter

Make screnshots of webpages with phantomjs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by rush

laravel image pdf gd imagick phantomjs jpg screenshot webpage png webshot

05/01 2016

0.1

0.1.0.0 https://github.com/hotrush/webshotter

Make screnshots of webpages with phantomjs

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by rush

laravel image pdf gd imagick phantomjs jpg screenshot webpage png webshot