定制 restpackio/restpack-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

restpackio/restpack-php

最新稳定版本:1.1.0

Composer 安装命令:

composer require restpackio/restpack-php

包简介

Restpack.io PHP client for HTML to PDF API, and Screenshot API

README 文档

README

Official PHP client for Restpack APIs

Installation

Requires PHP 5.6.

The recommended way to install restpack-php is through Composer:

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:

require "vendor/autoload.php";

Screenshot API

For detailed documentation, please visit Screenshot API v6 Reference page.

$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 */ ])

HTML To PDF API

For detailed documentation, please visit HTML to PDF API v5 Reference page.

$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 */ ])

统计信息

  • 总下载量: 99.65k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-12