Skip to content

A PHP Class to interact with Puppeteer and capture screenshot of a webpage

License

Notifications You must be signed in to change notification settings

tuhin18003/puppeteer-php-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Puppeteer PHP Bridge

Web site screenshot tool based on PHP and puppeteer You can use it to take screenshots for testing or monitoring service

Install

Via Composer

$ composer require tuhin18003/puppteer-php-bridge

After install the composer package go inside the jobs folder, then install the npm package

$ npm install

Usage

With this library you can make use of PhantomJs to screenshot a website.

Check our demo or read the following instructions.

Creating the object, you can either pass the url on the constructer or set it later on

use PuppetBridge\Capture;

try{
    $screenCapture = new Capture();
    $screenCapture->setImageType( 'png' );
    $screenCapture->setUrl( 'https://google.com' );
    $screenCapture->setTop(0);
    $screenCapture->setLeft(0);
    $screenCapture->setWidth( '600' );
    $screenCapture->setHeight( '600' );
    $screenCapture->save( 'images/testimg.png' ); // make sure images folder is writable

} catch (Exception $ex) {
    echo $ex->getMessage();
}

License

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

Credits

Thanks to the puppeteer (LICENSE) guys for creating their awesome WebKit scripting interface.

Special Thanks

About

A PHP Class to interact with Puppeteer and capture screenshot of a webpage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages