timbogdanov/bolt-pdf
Composer 安装命令:
composer require timbogdanov/bolt-pdf
包简介
High-performance Laravel Blade-to-PDF package using headless Chrome
README 文档
README
Blade-to-PDF rendering for Laravel 10/11/12+ using Headless Chrome — supports full CSS3, JS, modern layouts, headers, footers, watermarks, and more.
Built with 💪 performance, 🧠 modern standards, and 🖤 Laravel elegance.
✨ Features
- 🧾 Convert any Blade view to a high-fidelity PDF
- 🎨 Supports modern CSS3: flexbox, grid, custom fonts
- 🧠 Executes JavaScript: charts, animations, etc.
- 🧢 Add headers, footers, and watermark overlays
- 🧊 Save, stream, download, or cache PDFs
- 🔄 Supports queued generation for large documents
- 🔧 Fully configurable, extensible & testable
🚀 Installation
composer require timbogdanov/bolt-pdf If using Laravel < 5.5, register the service provider and facade manually in config/app.php. Otherwise, auto-discovery will handle it. Publish the config: bash Copy Edit php artisan vendor:publish --tag=config ⚙️ Configuration In .env: env Copy Edit BOLT_PDF_CHROME_PATH=/usr/bin/google-chrome BOLT_PDF_TIMEOUT=30 In config/boltpdf.php, you can customize default margins, paper size, etc. 🧑💻 Usage From a Blade view: php Copy Edit use BoltPdf\Facades\BoltPdf; return BoltPdf::view('pdf.invoice', ['invoice' => $invoice]) ->format('A4') ->landscape() ->header('<div>My Header</div>') ->footer('<div>Page <span class="pageNumber"></span></div>') ->watermark('CONFIDENTIAL') ->download('invoice.pdf'); Save to storage: php Copy Edit BoltPdf::view('pdf.report', $data) ->save('reports/weekly.pdf'); Queue generation (for large files): php Copy Edit GeneratePdfJob::dispatch('pdf.report', $data, 'reports/big.pdf'); 📂 API Reference Method Description view($blade, $data) Load a Blade view html($html) Load raw HTML content format('A4') Set paper format landscape() Switch to landscape mode timeout(30) Set render timeout (in seconds) header($html) Add header HTML footer($html) Add footer HTML watermark($text) Add watermark text stream($filename) Stream PDF in browser download($filename) Force download of the PDF save($path) Save to local or cloud storage output() Return raw PDF content (binary) 🧪 Testing bash Copy Edit php artisan test Or with PHPUnit: bash Copy Edit ./vendor/bin/phpunit 🧩 Roadmap Headers & footers Watermark overlay Queued job support Blade directive: @pdf Caching support (->cache('key')) Chrome process pooling 🛡 Requirements PHP 8.1+ Laravel 10/11/12+ Chrome or Chromium installed locally (/usr/bin/google-chrome or path in config) ❤️ Credits Built by Tim Bogdanov. Powered by chrome-php/chrome and the Laravel ecosystem. 📄 License MIT © 2025 yaml Copy Edit --- Let me know if you’d like a logo, docs site scaffold, or a publish-to-Packagist checklist!
timbogdanov/bolt-pdf 适用场景与选型建议
timbogdanov/bolt-pdf 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 timbogdanov/bolt-pdf 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 timbogdanov/bolt-pdf 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-03-21