A standalone PHP library for rendering digest data as HTML reports and dashboards.
This library takes structured data (associative arrays or JSON) from DigestModules and generates HTML output including tables, charts, and summary reports. It's designed to be reusable across different accounting systems and digest implementations.
- Multiple Output Formats: HTML pages, email-friendly HTML, PDF-ready markup
- Responsive Design: Bootstrap-based responsive templates
- Customizable Themes: Easy theme and styling customization
- Chart Support: Built-in chart generation for data visualization
- Email Integration: Optimized HTML for email clients
- Modular Renderers: Separate renderers for different module types
composer require vitexsoftware/digest-rendereruse VitexSoftware\DigestRenderer\DigestRenderer;
// Load data from DigestModules
$digestData = json_decode(file_get_contents('digest_data.json'), true);
// Create renderer
$renderer = new DigestRenderer();
// Configure theme (optional)
$renderer->setTheme('bootstrap'); // or 'email', 'print'
// Render HTML
$html = $renderer->render($digestData);
// Save to file
file_put_contents('digest.html', $html);
// Or send by email
$emailRenderer = new DigestRenderer();
$emailRenderer->setTheme('email');
$emailHtml = $emailRenderer->render($digestData);- Responsive design
- Modern Bootstrap 5 components
- Interactive elements
- Chart.js integration
- Email client compatibility
- Inline CSS styles
- Table-based layouts
- Outlook compatibility
- Print-optimized styling
- Page break handling
- Monochrome-friendly colors
Each module type has a dedicated renderer:
use VitexSoftware\DigestRenderer\Renderers\OutcomingInvoicesRenderer;
use VitexSoftware\DigestRenderer\Renderers\DebtorsRenderer;
// Render specific module
$invoiceRenderer = new OutcomingInvoicesRenderer();
$html = $invoiceRenderer->render($moduleData);$renderer = new DigestRenderer();
$renderer->setCustomCss('
.digest-header { background: #custom-color; }
.module-card { border: 1px solid #ccc; }
');$renderer = new DigestRenderer();
$renderer->setTemplate('custom_template.php');The renderer expects data in this format:
{
"digest": {
"period": {"start": "2024-01-01", "end": "2024-02-01"},
"company": {"name": "Company Name"},
"timestamp": "2024-01-15T10:30:00Z"
},
"modules": {
"outcoming_invoices": {
"module_name": "outcoming_invoices",
"heading": "Outcoming Invoices",
"success": true,
"data": {...}
}
}
}GPL-2.0-or-later