PHP code example of restpackio / restpack-php

1. Go to this page and download the library: Download restpackio/restpack-php 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/ */

    

restpackio / restpack-php example snippets




$screenshot = new Restpack\Screenshot("<YOUR ACCESS TOKEN>");

// Capture given URL. Return the document details and CDN url of the Image
$screenshot->capture("http://google.com", [ "format" => "png" /* , other options */ ])

// Capture given html content. Return the document details and CDN url of the Image
$screenshot->captureHTML("<p><b>Bold text</b> etc</p>", [ "format" => "png" /* , other options */ ])

// Capture given URL. Return the image file as Buffer
$screenshot->captureToImage("http://google.com", [ "format" => "png" /* , other options */ ])

// Capture given html content. Return the image file as Buffer
$screenshot->captureHTMLToImage("<p><b>Bold text</b> etc</p>", [ "format" => "png" /* , other options */ ])

$htmlpdf = new Restpack\HTMLToPDF("<YOUR ACCESS TOKEN>");

// Convert given URL to PDF. Return the document details and CDN url of PDF
$htmlpdf->convert("http://google.com", [ "pdf_page" => "A4" /* , other options */ ])

// Convert given html content to PDF. Return the document details and CDN url of PDF
$htmlpdf->convertHTML("<p><b>Bold text</b> etc</p>", [ "pdf_page" => "A4" /* , other options */ ])

// Convert given URL to PDF. Return the PDF document as Buffer
$htmlpdf->convertToPDF("http://google.com", [ "pdf_page" => "A4" /* , other options */ ])

// Convert given html content to PDF. Return the PDF document as Buffer
$htmlpdf->convertHTMLToPDF("<p><b>Bold text</b> etc</p>", [ "pdf_page" => "A4" /* , other options */ ])

$ curl -sS https://getcomposer.org/installer | php

$ php composer.phar