/** * Register the service provider. * * @return void */ public function register() { $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'phantom-pdf'); $this->app->singleton('phantom-pdf', function () { $generator = new PdfGenerator(); $generator->setBaseUrl($this->app['config']['phantom-pdf.base_url'] ?: url()); $generator->setStoragePath($this->app['config']['phantom-pdf.temporary_file_path']); $generator->setTimeout($this->app['config']['phantom-pdf.timeout']); foreach ($this->app['config']['phantom-pdf.command_line_options'] as $option) { $generator->addCommandLineOption($option); } return $generator; }); }
/** * Register the service provider. * * @return void */ public function register() { //phantom-pdf $this->app->bind('phantom-pdf', function () { $generator = new PdfGenerator(); $generator->setBaseUrl($this->app['config']['phantom-pdf::base_url'] ?: url()); $generator->setStoragePath($this->app['config']['phantom-pdf::temporary_file_path']); $generator->setTimeout($this->app['config']['phantom-pdf::timeout']); if ($this->app['config']['phantom-pdf::ignore_ssl_errors']) { $generator->ignoreSSLErrors(); } foreach ($this->app['config']['phantom-pdf::command_line_options'] as $option) { $generator->addCommandLineOption($option); } $this->app->finish(function () use($generator) { $generator->deleteTempFiles(); }); return $generator; }); }
/** * Register the service provider. * * @return void */ public function register() { $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'phantom-pdf'); $this->app->singleton('phantom-pdf', function () { $generator = new PdfGenerator(); $baseUrl = $this->app['config']['phantom-pdf.base_url']; $generator->setBaseUrl(is_null($baseUrl) ? null : url($baseUrl)); $generator->setBinaryPath($this->app['config']['phantom-pdf.binary_path']); $generator->setStoragePath($this->app['config']['phantom-pdf.temporary_file_path']); $generator->setTimeout($this->app['config']['phantom-pdf.timeout']); if ($this->app['config']['phantom-pdf.conversion_script']) { $generator->useScript($this->app['config']['phantom-pdf.conversion_script']); } foreach ($this->app['config']['phantom-pdf.command_line_options'] as $option) { $generator->addCommandLineOption($option); } return $generator; }); $this->app->alias('phantom-pdf', PdfGenerator::class); }