cloudlayerio / cloudlayerio-php
cloudlayer.io API Library for easy access to our REST based API services using PHP.
Installs: 17 115
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- ext-json: *
- guzzlehttp/guzzle: ^7.2
Requires (Dev)
- mikey179/vfsstream: ^1.6
- phpunit/phpunit: ^9
- symfony/dotenv: ^5.1
README
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
require __DIR__ ."/vendor/autoload.php";
- configure a client with api key
use CloudLayerIO\Client as CloudLayer;
$apiKey = '<YOUR_API_KEY>';
CloudLayer::config([
'api_key' => $apiKey,
]);
- 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');
- convert HTML to image or pdf
$html = \CloudLayerIO\Resource\Html('<html></html>');
$html->toImage(); // return object of \CloudLayerIO\Model\File
$html->toPdf(); // return object of \CloudLayerIO\Model\File