Download the PHP package microweber/screen without Composer
On this page you can find all versions of the php package microweber/screen. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download microweber/screen
More information about microweber/screen
Files in microweber/screen
Package screen
Short Description A PHP Class to interact with PhantomJs and capture screenshot of a webpage
License MIT
Informations about the package screen
Screen
Web site screenshot tool based on PHP and PhantomJS You can use it to take screenshots for testing or monitoring service
Install
Via Composer
If on any Unix system, you need to make the bin
executable chmod +x /path/to/screen/bin/phantomjs
The directory /path/to/screen/jobs
must be writable as well.
Linux requirements
- FontConfig -
apt-get/yum install fontconfig
- FreeType -
apt-get/yum install freetype*
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 constructor or set it later on
You can also set the browser dimensions
you can set also DOM Element Position (top, left)
This will output all the page including the content rendered beyond the setted dimensions (e.g.: all the scrollable content), if you want just the content inside those boudaries you need to clip the result
Some webpages don't have a background color setted to the body, if you want you can set the color using this method
You can also set the User Agent
And the resulted image type
- If the format is and the background color is not set, the default value will be , if the default background color will be transparent.
And most importantly, save the result
Injection your own JS into the web page
You can also run your own JS scripts or snippets before the screenshot.
For that we have the method , here are some usage examples:
Just use this method before calling
Passing options to PhantomJS
You can set the options that will be passed to the PhantomJS binary.
Other configurations
Additionally to the basic usage, you can set so extra configurations.
You can change the where the PhantomJS binary file is.
Change the jobs location
And set an output base location
You can also clean/delete all the generated job files like this:
License
The MIT License (MIT). Please see License File for more information.
Credits
- Peter Ivanov
- André Filipe
- All Contributors
Thanks to the PhantomJS (LICENSE) guys for creating their awesome WebKit scripting interface.
This tool was originally created to take screenshots for Microweber