PHP code example of g4t / webshot

1. Go to this page and download the library: Download g4t/webshot library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

g4t / webshot example snippets


   composer 

use g4t\WebShot\Screenshot;

$save_path = public_path('files/save.png');
return Screenshot::take('https://google.com')
                  ->size('14-inc')
                  ->saveAs($save_path)
                  ->url();

use g4t\WebShot\Screenshot;

$save_path = public_path('files/save.png');
return Screenshot::take('https://google.com')
                  ->size('14-inc')
                  ->saveAs($save_path)
                  ->path();

use g4t\WebShot\Screenshot;

$save_path = public_path('files/save.png');
return Screenshot::take('https://google.com')
          ->size('14-inc')
          ->saveAs($save_path)
          ->download();


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();


'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'