core-system / laravel-snappy by marley-ma
forked from barryvdh/laravel-snappy

Snappy PDF/Image for Laravel 5 with temp folder settings
51
0
3
Package Data
Maintainer Username: marley-ma
Maintainer Contact: kuba@havle.cz (Jakub Havle)
Package Create Date: 2016-08-04
Package Last Update: 2016-08-04
Language: PHP
License: MIT
Last Refreshed: 2024-03-26 03:11:06
Package Statistics
Total Downloads: 51
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 3
Total Forks: 0
Total Open Issues: 0

CORE-SYSTEM Snappy PDF/Image WrapperLaravel 5 and Lumen 5.1

This package is fork for laravel-snappy package: https://github.com/barryvdh/laravel-snappy. All credit to them ;)

This package adds ability to set temporary folder for Snappy. The reason for that was problem with rights for writting to tmp folder. Snappy use by default sys_get_temp_dir function for getting path of temporary directory.

This package is part of core-system packages for Laravel 5 Framework.

CORE-SYSTEM is Laravel 5.2 based web CMS application

CORE-SYSTEM Snappy PDF/Image Wrapper extends barryvdh/laravel-snappy and adds ability to set temporary folder in config file.

Summary

License

This Snappy Wrapper for Laravel is open-sourced software licensed under the MIT license

Installation

Require this package in your composer.json and update composer.

composer require core-system/laravel-snappy

Laravel

After updating composer, add the ServiceProvider to the providers array in app/config/app.php

CoreSystem\Snappy\ServiceProvider::class,

You can optionally use the facade for shorter code. Add this to your facades:

'PDF' => CoreSystem\Snappy\Facades\SnappyPdf::class,
'SnappyImage' => CoreSystem\Snappy\Facades\SnappyImage::class,

You can publish the config-file to change some settings (default paper etc).

php artisan vendor:publish

Lumen

In bootstrap/app.php add:

class_alias('CoreSystem\Snappy\Facades\SnappyPdf', 'PDF');
$app->register(CoreSystem\Snappy\LumenServiceProvider::class);

Optionally, add the facades like so:

class_alias(CoreSystem\Snappy\Facades\SnappyPdf::class, 'PDF');
class_alias(CoreSystem\Snappy\Facades\SnappyImage::class, 'SnappyImage');

To customise the configuration file, copy the file /vendor/core-system/laravel-snappy/config/snappy.php to the /config folder.

Config

return [
 'pdf'   => array(
        'enabled'     => true,
        'binary'      => '/usr/local/bin/wkhtmltopdf',
        'timeout'     => false,
        'options'     => array(),
        'env'         => array(),
        'temp-folder' => null, //example for laravel/lumen 'temp-folder' => storage_path('app/snappy/pdf')
    ),
    'image' => array(
        'enabled'     => true,
        'binary'      => '/usr/local/bin/wkhtmltoimage',
        'timeout'     => false,
        'options'     => array(),
        'env'         => array(),
        'temp-folder' => null, //example for laravel/lumen 'temp-folder' => storage_path('app/snappy/img')
    ),  
];

Usage

For examples how use this package follow this link: https://github.com/barryvdh/laravel-snappy