项目作者: cloudlayerio

项目描述 :
cloudlayerio (https://cloudlayer.io) - API Library for easy access to our REST based API services using PHP
高级语言: PHP
项目地址: git://github.com/cloudlayerio/cloudlayerio-php.git
创建时间: 2020-11-15T16:19:25Z
项目社区:https://github.com/cloudlayerio/cloudlayerio-php

开源协议:Apache License 2.0

下载


cloudlayerio-php

cloudlayerio API Library for easy access to our REST based API services using PHP.

  • Convert HTML to PDFs and Images
  • Convert Webpages to PDFs and Images (using any public URL)

Example Usage

  • load composer dependencies
    1. require __DIR__ ."/vendor/autoload.php";
  • configure a client with api key
    ```

use CloudLayerIO\Client as CloudLayer;

$apiKey = ‘‘;

CloudLayer::config([
‘api_key’ => $apiKey,
]);

  1. - convert URL to image or pdf

$url = \CloudLayerIO\Resource\Url(‘http://exampl.com‘);
$image = $url->toImage(); // return object of \CloudLayerIO\Model\File

//save image file
$image->save(‘test.png’);

$pdf = $url->toPdf(); // return object of \CloudLayerIO\Model\File
//save pdf file
$pdf->save(‘test.pdf’);

  1. - convert HTML to image or pdf

$html = \CloudLayerIO\Resource\Html(‘‘);
$html->toImage(); // return object of \CloudLayerIO\Model\File
$html->toPdf(); // return object of \CloudLayerIO\Model\File
```