ryodevz/phpexport

v3.2.0 2023-10-12 17:37 UTC

This package is auto-updated.

Last update: 2024-09-12 20:10:58 UTC


README

phpexport 是一个用于将 HTML 导出为 PDF、Excel 或 DOCX 的库。

安装

使用包管理器 composer 安装 phpexport。

composer require ryodevz/phpexport

用法

<?php

use Ryotwell\Phpexport\Support\Facade\Export;

// Init the class
$exporter = new Export;

// The html
$html = '<h1>Lorem ipsum dolor sit amet consectetur adipisicing elit. Error, ratione.</h1>';

// Export to PDF and download
$exporter->makePDF($html)
    ->download('document.pdf'); // This parameter is optional, with the default value of 'filename.pdf'.

// Export to PDF and preview
$exporter->makePDF($html)
    ->preview(); // The method preview() is only available for PDF

// Export to Excel and download
$exporter->makeExcel($html)
    ->download();

// Export to MSWord and download
$exporter->makeWord($html)
    ->download();

贡献

欢迎提交拉取请求。对于重大更改,请先创建一个问题来讨论您想进行哪些更改。

请确保根据需要更新测试。