nass600/snappy-service-provider

Snappy Service Provider for Silex

v2.0.0 2015-09-07 07:00 UTC

This package is not auto-updated.

Last update: 2024-12-17 04:42:06 UTC


README

Silex Service for snappy library integration.

Build Status Latest Stable Version Total Downloads License SensioLabsInsight

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

MIT

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

Authors