PHP code example of toolreport / core

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

    

toolreport / core example snippets


// API prefix (default: api/pdf-designer)
'api_prefix' => env('PDF_DESIGNER_API_PREFIX', 'api/pdf-designer'),

// Storage disk for generated PDFs
'storage' => [
    'disk' => env('PDF_DESIGNER_STORAGE_DISK', 'local'),
    'path' => env('PDF_DESIGNER_STORAGE_PATH', 'pdf-documents'),
],

// PDF engine selection per template
'pdf-engine' => [
    'enabled' => env('PDF_DESIGNER_PDF_ENGINE_ENABLED', true),
    'default_font' => env('PDF_DESIGNER_PDF_ENGINE_FONT', 'dejavusans'),
],

use Toolreport\Core\Facades\PdfDesigner;
use Toolreport\Core\Models\PdfTemplate;

$template = PdfTemplate::find(1);

// Render a single template
$document = PdfDesigner::renderTemplate($template, [
    'company' => 'Acme Corp',
    'total' => '$1,234.56',
], 'Invoice #1001');

// The returned PdfDocument has file_path and file_size
echo $document->file_path; // e.g. pdf-documents/acme-corp_1.pdf
bash
php artisan pdf-designer:install
bash
# Config
php artisan vendor:publish --tag=pdf-designer-config

# Migrations
php artisan vendor:publish --tag=pdf-designer-migrations
bash
php artisan vendor:publish --tag=pdf-designer-views