ghans/mpdf-laravel-wrapper
Composer 安装命令:
composer require ghans/mpdf-laravel-wrapper
包简介
Fork from mpdf/mpdf adapted to laravel 5.*
README 文档
README
mPDF is a PHP library which generates PDF files from UTF-8 encoded HTML.
It is based on FPDF and HTML2FPDF (see CREDITS), with a number of enhancements. mPDF was written by Ian Back and is released under the GNU GPL v2 licence.
Note: If you are viewing this file on mPDF Github repository homepage or on Packagist, please note that the default repository branch is
developmentwhich can differ from the last stable release.
Requirements
mPDF 7.0 requires PHP ^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0. PHP mbstring and gd extensions have to be loaded.
and Laravel 5.x
Additional extensions may be required for some advanced features such as zlib for compression of output and
embedded resources such as fonts, bcmath for generating barcodes or xml for character set conversion
and SVG handling.
mPDF has some problems with fetching external HTTP resources with single threaded servers such as php -S. A proper
server such as nginx (php-fpm) or Apache is recommended.
Support us
Consider supporting development of mPDF with a donation of any value. Donation button can be found on the main page of the documentation.
Installation
Official installation method is via composer and its packagist package mpdf/mpdf.
$ composer require ghans/mpdf-laravel-wrapper:dev-development
for Laravel <5.5 in file config/app.php includes:
'providers' => [ ... /* * Package Service Providers... */ ... Mpdf\Providers\PDFServiceProvider::class, ...
in the section aliases include
'aliases'=>[ ... "mpdf"=> Mpdf\Providers\PDFFacade::class, ...
Usage
The simplest usage (since version 7.0) of the library would be as follows:
<?php use mpdf; mpdf::writeHTML('<h1>Hello world!</h1>'); mpdf::output();
This will output the PDF inline to the browser as application/pdf Content-type.
Setup & Configuration
All configuration directives can
be set by the $config parameter of the constructor.
It is recommended to set one's own temporary directory via tempDir configuration variable.
The directory must have write permissions (mode 775 is recommended) for users using mPDF
(typically cli, webserver, fpm).
Warning: mPDF will clean up old temporary files in the temporary directory. Choose a path dedicated to mPDF only.
<?php $mpdf = new \Mpdf\Mpdf(['tempDir' => __DIR__ . '/tmp']);
By default, the temporary directory will be inside vendor directory and will have correct permissions from
post_install composer script.
For more information about custom temporary directory see the note on Folder for temporary files in the section on Installation & Setup in the manual.
If you have problems, please read the section on troubleshooting in the manual.
Online manual
Online manual is available at https://mpdf.github.io/.
For general questions or troubleshooting please use the mpdf tag at Stack Overflow (and not the project's issue tracker).
Contributing
Please read before submitting issues and pull requests the CONTRIBUTING.md file.
Unit Testing
Unit testing for mPDF is done using PHPUnit.
To get started, run composer install from the command line while in the mPDF root directory
(you'll need composer installed first).
To execute tests, run vendor/bin/phpunit from the command line while in the mPDF root directory.
Any assistance writing unit tests for mPDF is greatly appreciated. If you'd like to help, please
note that any PHP file located in the /tests/ directory will be autoloaded when unit testing.
ghans/mpdf-laravel-wrapper 适用场景与选型建议
ghans/mpdf-laravel-wrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 324 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 12 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「pdf」 「utf-8」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ghans/mpdf-laravel-wrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ghans/mpdf-laravel-wrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ghans/mpdf-laravel-wrapper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
tfpdf
Removes invalid UTF-8 characters from the given text
Country Flag Emoji for PHP
A collection of PHP multi-byte string functions that are not present in the mb_string extension.
Provides TCPDF integration for Symfony
Alfabank REST API integration
统计信息
- 总下载量: 324
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2017-12-19