g4t / webshot
Package to take screenshoot for web page as image or pdf.
README
Introduction
Laravel G4T WebShot is a powerful PHP package designed to capture screenshots or generate PDFs from any web page. It provides robust functionality for managing and retrieving screen dimensions based on predefined identifiers.
Installation
To install the Laravel G4T WebShot, follow these steps:
-
Install via Composer:
composer require g4t/webshot
Usage
Getting Started
- Capture and Return Full Path:
To capture a screenshot of a web page and return its URL:
use g4t\WebShot\Screenshot; $save_path = public_path('files/save.png'); return Screenshot::take('https://google.com') ->size('14-inc') ->saveAs($save_path) ->url();
- Capture and Download:
To capture a screenshot of a web page and download it directlyURL:
use g4t\WebShot\Screenshot; $save_path = public_path('files/save.png'); return Screenshot::take('https://google.com') ->size('14-inc') ->saveAs($save_path) ->path();
- Capture and Download:
To capture a screenshot of a web page and download it directly:
use g4t\WebShot\Screenshot; $save_path = public_path('files/save.png'); return Screenshot::take('https://google.com') ->size('14-inc') ->saveAs($save_path) ->download();
- Custom Size:
To specify custom dimensions for the screenshot:
use g4t\WebShot\Screenshot; $save_path = public_path('files/save.png'); return Screenshot::take('https://google.com') ->customSize(width: 1000, height: 1000) ->saveAs($save_path) ->download();
- The following screen sizes are available:
'13-inc', '14-inc', '15-inc', '16-inc', 'iphone-SE1st', 'iphone-SE-2nd', 'iphone-6', 'iphone-6s', 'iphone-7', 'iphone-8', 'iphone-8-plus', 'iphone-11-pro-max', 'ipad-landscape', 'ipad-pro-10.5-landscape', 'ipad-pro-11-inch-landscape', 'ipad-pro-12.9-inch-landscape', 'full-hd', '2k', '4k'
Contributing
Contributions to the Laravel G4T WebShot Package are always welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
License
The Laravel G4T WebShot is open-source software licensed under the MIT license.
Credits
The Laravel G4T WebShot Package is developed and maintained by HusseinAlaa.