https://github.com/restpackio/restpack-php
Restpack.io PHP client for HTML to PDF API, and Screenshot API
https://github.com/restpackio/restpack-php
html2pdf restpack screenshot
Last synced: 6 months ago
JSON representation
Restpack.io PHP client for HTML to PDF API, and Screenshot API
- Host: GitHub
- URL: https://github.com/restpackio/restpack-php
- Owner: restpackio
- Created: 2018-04-12T13:56:58.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T20:49:38.000Z (about 3 years ago)
- Last Synced: 2025-09-28T03:32:27.188Z (8 months ago)
- Topics: html2pdf, restpack, screenshot
- Language: PHP
- Homepage: https://restpack.io
- Size: 15.6 KB
- Stars: 1
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# reastpack-php
Official PHP client for Restpack APIs
## Installation
Requires PHP 5.6.
The recommended way to install restpack-php is through [Composer](https://getcomposer.org):
First, install Composer:
```
$ curl -sS https://getcomposer.org/installer | php
```
Next, install the latest restpack-php:
```
$ php composer.phar require restpackio/restpack-php
```
Finally, you need to require the library in your PHP application:
```php
require "vendor/autoload.php";
```
## Screenshot API
For detailed documentation, please visit [Screenshot API v6 Reference page](https://restpack.io/screenshot/docs).
```php
$screenshot = new Restpack\Screenshot("");
// 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("
Bold text etc
", [ "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("
Bold text etc
", [ "format" => "png" /* , other options */ ])
```
## HTML To PDF API
For detailed documentation, please visit [HTML to PDF API v5 Reference page](https://restpack.io/html2pdf/docs).
```php
$htmlpdf = new Restpack\HTMLToPDF("");
// 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("
Bold text etc
", [ "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("
Bold text etc
", [ "pdf_page" => "A4" /* , other options */ ])
```