public function boot()
{
$configPath = __DIR__ . '/../config/snappy.php';
$this->publishes([$configPath => config_path('snappy.php')], 'config');
if ($this->app['config']->get('snappy.pdf.enabled')) {
$this->app['snappy.pdf'] = $this->app->share(function ($app) {
$binary = $app['config']->get('snappy.pdf.binary', '/usr/local/bin/wkhtmltopdf');
$options = $app['config']->get('snappy.pdf.options', array());
$env = $app['config']->get('snappy.pdf.env', array());
$timeout = $app['config']->get('snappy.pdf.timeout', false);
$snappy = new IlluminateSnappyPdf($app['files'], $binary, $options, $env);
if (false !== $timeout) {
$snappy->setTimeout($timeout);
}
return $snappy;
});
$this->app['snappy.pdf.wrapper'] = $this->app->share(function ($app) {
return new PdfWrapper($app['snappy.pdf']);
});
$this->app->alias('snappy.pdf.wrapper', 'Barryvdh\\Snappy\\PdfWrapper');
}
if ($this->app['config']->get('snappy.image.enabled')) {
$this->app['snappy.image'] = $this->app->share(function ($app) {
$binary = $app['config']->get('snappy.image.binary', '/usr/local/bin/wkhtmltoimage');
$options = $app['config']->get('snappy.image.options', array());
$env = $app['config']->get('snappy.image.env', array());
$timeout = $app['config']->get('snappy.image.timeout', false);
$image = new IlluminateSnappyImage($app['files'], $binary, $options, $env);
if (false !== $timeout) {
$image->setTimeout($timeout);
}
return $image;
});
$this->app['snappy.image.wrapper'] = $this->app->share(function ($app) {
return new ImageWrapper($app['snappy.image']);
});
$this->app->alias('snappy.image.wrapper', 'Barryvdh\\Snappy\\ImageWrapper');
}
}