nass600 / snappy-service-provider
Snappy Service Provider for Silex
v2.0.0
2015-09-07 07:00 UTC
Requires
- php: >=5.5.9
- knplabs/knp-snappy: ~0.3
- silex/silex: ~2.0@dev
This package is not auto-updated.
Last update: 2024-12-17 04:42:06 UTC
README
Silex Service for snappy
library integration.
Installation
Require the library in your composer.json file:
{ "require": { "nass600/snappy-service-provider": "1.0.1", } }
or execute:
composer require "nass600/snappy-service-provider:1.0.1"
Parameters
- snappy.pdf.binary: Absolute path to
wkhtmltopdf
. - snappy.pdf.options: Array of options to give to Snappy (see wkhtmltopdf doc).
- snappy.image.binary: Absolute path to
wkhtmltoimage
. - snappy.image.options: Array of options to give to Snappy (see wkhtmltoimage doc).
Services
- snappy.pdf: Snappy service to create pdf.
- snappy.image: Snappy service to create image snapshots / thumbnails.
Registering
<?php use Silex\Application; use Nass600\Silex\Provider\SnappyServiceProvider; $app = new Application(); $app->register(new SnappyServiceProvider(), array( 'snappy.pdf.binary' => '/path/to/wkhtmltopdf', 'snappy.pdf.options' => array( 'footer-center' => 'page [page]' ), 'snappy.image.binary' => '/path/to/wkhtmltoimage', 'snappy.image.options' => array( 'format' => 'png' ) ));
Usage
License
Credits
This is a simple Silex Provider to use this amazing tools:
- KnpLabs: The snappy PHP5 library
- Wkhtmltopdf: The command line tools to render HTML into PDF