rarog/dompdf-helper
最新稳定版本:4.2.0
Composer 安装命令:
composer require rarog/dompdf-helper
包简介
DompdfHelper - a lightweight library wrapper Laminas module
README 文档
README
DompdfHelper - a lightweight library wrapper Laminas module
Requirements
Installation
Installation of DompdfHelper uses PHP Composer. For more information about PHP Composer, please visit the official PHP Composer site.
Installation steps
-
cd my/project/directory -
create a
composer.jsonfile with following contents:{ "require": { "rarog/dompdf-helper": "^4.0" } } -
install PHP Composer via
curl -s http://getcomposer.org/installer | php(on windows, download http://getcomposer.org/installer and execute it with PHP) -
run
php composer.phar install -
open
my/project/directory/config/application.config.phpand add the following key to yourmodules:'DompdfHelper',
Configuration options
You can override default options via the dompdf key in your local or global config files. See the config/dompdf.config.php.dist file for the list of default settings.
Full list of possible settings is available at the official Dompdf library site.
Example usage
Controller factory
<?php namespace My\Factory\Controller; use Interop\Container\ContainerInterface; use My\Controller\ExampleController; class ExampleControllerFactory implements FactoryInterface { /** * {@inheritDoc} * @see \Laminas\ServiceManager\Factory\FactoryInterface::__invoke() */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { return new ExampleController( $container->get('dompdf') ); } }
Controller
<?php namespace My\Controller; use Dompdf\Dompdf; use Laminas\Mvc\Controller\AbstractActionController; class ExampleController extends AbstractActionController { /** * @var Dompdf */ private $dompdf; /** * Constructor * * @param Dompdf $dompdf */ public function __construct( Dompdf $dompdf ) { $this->dompdf = $dompdf; } public function indexAction() { $this->dompdf->load_html('<strong>Hello World</strong>'); $this->dompdf->render(); file_put_contents(__DIR__ . '/document.pdf', $this->dompdf->output()); } }
统计信息
- 总下载量: 26.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2020-06-06