row-bloom/chrome-php-renderer

row-bloom renderer driver

v0.2.0 2024-01-01 14:49 UTC

This package is auto-updated.

Last update: 2024-11-30 18:11:27 UTC


README

Latest Version on Packagist Pest action Pint action Total Downloads

Important

This is a sub-split, for development, pull requests and issues, visit: https://github.com/row-bloom/row-bloom

Installation

composer require row-bloom/chrome-php-renderer
use RowBloom\RowBloom\Support;
use RowBloom\ChromePhpRenderer\ChromePhpRenderer;

app()->get(Support::class);
    ->registerInterpolatorDriver(ChromePhpRenderer::NAME, ChromePhpRenderer::class)

Requires:

  • PHP >= 8.1

chrome-php/chrome dependencies:

  • ext-sockets

Usage

use RowBloom\ChromePhpRenderer\ChromePhpRenderer;
use RowBloom\RowBloom\Interpolators\PhpInterpolator;
use RowBloom\RowBloom\RowBloom;

app()->get(RowBloom::class)
    ->addTable([
        ['title' => 'Title1', 'body' => 'body1'],
        ['title' => 'Title2', 'body' => 'body2'],
    ])
    ->setInterpolator(PhpInterpolator::class)
    ->setTemplate('
        <h1><?= $title ?></h1>
        <p>Bold text</p>
        <div><?= $body ?></div>
    ')
    ->setRenderer(ChromePhpRenderer::class)
    ->save(__DIR__.'/foo.pdf');

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.