Download the PHP package shoaib3375/php-doc-exporter without Composer
On this page you can find all versions of the php package shoaib3375/php-doc-exporter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-doc-exporter
PHP Doc Exporter
An all-in-one PHP/Laravel library to generate professional documents in PDF, Excel, Word, and CSV formats with specialized support for Bangla Unicode and built-in API Token Security.
🚀 Features
- Blade Template Support: Use Laravel Blade views for custom PDF layouts
- Bangla Support: Auto-detects Bangla Unicode and switches to bundled NotoSansBengali font automatically.
- Multi-Format: One interface for 4 major document types.
- Secure: Built-in logic for Main and Safe API tokens for external integrations.
- Performant: Optimized for speed and minimal memory footprint.
- API Ready: Perfect for REST APIs with token-based authentication
🛠 Installation
You can install the package via composer:
Laravel Setup (Optional)
The package auto-registers in Laravel. Optionally publish the config:
Then configure tokens in .env:
📖 Quick Start
Basic Usage (Plain PHP)
Laravel Controller Example
Using Blade Templates (NEW)
API with Token Authentication
🎨 Blade Template Support
Creating a Blade Template
Create a view file at resources/views/invoice.blade.php:
Using the Template
Benefits
- Custom Layouts: Design complex documents with full HTML/CSS control
- Reusable Templates: Share templates across your application
- Dynamic Content: Use Blade directives (@if, @foreach, @include)
- Bangla Support: Full Unicode support in templates
🎨 Advanced Options
PDF Customization
Word/Excel Customization
Data Format
Use associative arrays where keys become column headers:
🔒 API Token Security (Optional)
Using Tokens for Protected Exports
Custom Token Configuration
🇧🇩 Bangla Unicode Support
All formats support Bangla Unicode automatically — no configuration needed.
The package detects Bangla characters in your data and applies the correct font.
Bangla font (NotoSansBengali) is bundled inside the package — no manual font installation required.
Excel / Word / CSV
These formats use Unicode-native libraries and work out of the box.
Manual font override (optional)
If you need a specific font, you can still pass it explicitly:
📄 API Reference
DocumentExporter
exportFromView(string $format, string $view, array $data = [], array $options = [], string $token = null): string
Generates PDF from Blade template (Laravel only).
Parameters:
$format- Currently only'pdf'supported for views$view- Blade view name (e.g.,'invoice'forresources/views/invoice.blade.php)$data- Data to pass to the Blade view$options- Optional settings:paper- PDF paper size (A4, Letter, Legal)orientation- PDF orientation (portrait, landscape)font- PDF font (auto-detected: Bangla → NotoSansBengali, else DejaVu Sans)$token- Optional API token for validation
Returns: PDF content as string
Throws: InvalidFormatException or InvalidTokenException
export(string $format, array $data, array $options = [], string $token = null): string
Generates document content and returns as string.
Parameters:
$format- Format type:'pdf','excel','word','csv'$data- Associative array of data (keys = headers)$options- Optional settings:title- Document titlepaper- PDF paper size (A4, Letter, Legal)orientation- PDF orientation (portrait, landscape)font- PDF font (auto-detected: Bangla → NotoSansBengali, else DejaVu Sans)$token- Optional API token for validation
Returns: Document content as string
Throws: InvalidArgumentException for invalid format or token
Config
| Method | Description |
|---|---|
canAccessFullApi(string $token): bool |
Validates main API token |
canAccessSafeApi(string $token): bool |
Validates safe or main token |
getMainApiToken(): string |
Returns primary token |
getSafeApiToken(): string |
Returns secondary token |
📜 License
The MIT License (MIT). Please see License File for more information.
All versions of php-doc-exporter with dependencies
dompdf/dompdf Version ^2.0
phpoffice/phpspreadsheet Version ^1.28
phpoffice/phpword Version ^1.1