PHP code example of justinholtweb / craft-donky

1. Go to this page and download the library: Download justinholtweb/craft-donky 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/ */

    

justinholtweb / craft-donky example snippets


use justinholtweb\donky\services\Documents;
use justinholtweb\donky\services\Renderer;

Event::on(Documents::class, Documents::EVENT_BEFORE_ISSUE_DOCUMENT, function($event) {
    $event->document->snapshot['custom'] = 'anything';   // the snapshot is still writable
});

Event::on(Renderer::class, Renderer::EVENT_BEFORE_RENDER, function($event) {
    $event->pdf = myOwnRenderer($event->html);           // set this and dompdf is never called
});