PHP code example of chromeheadlessio / php-client

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

    

chromeheadlessio / php-client example snippets



//Use PHP Client Library
ce with your token key specified
$service = new \chromeheadlessio\Service("my-token-key");

//Get PDF generated from html content and push it to browser
$service->export([
    "html"=>"Hello world!"
])->pdf([
    "format"=>"A4",
    "orientation"=>"portrait"
])->sendToBrowser("helloworld.pdf");

$settings = [
    // ... your usual settings (serviceHost, token, html/url, ...) ...
    'resourceCache' => [
        'enabled' => true,
    ],
];
$report->run()->cloudExport($view)->settings($settings)->pdf($opts)->toBrowser($name);

'resourceCache' => [
    'enabled'     => true,
    'cacheCustom' => ['scope' => 'tenant'], // or 'global'
],
bash
composer 

//MyReportPDF.view.php
<body style='margin: 1in 0.5in 1in 0.5in'>
...
</body>