Download the PHP package maximegratens/lara-snappy without Composer

On this page you can find all versions of the php package maximegratens/lara-snappy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package lara-snappy

Snappy PDF/Image Wrapper for Laravel 5 and Lumen 5.1

This package is a ServiceProvider for Snappy: https://github.com/KnpLabs/snappy.

Wkhtmltopdf Installation

Choose one of the following options to install wkhtmltopdf/wkhtmltoimage.

  1. Download wkhtmltopdf from here;
  2. Or install as a composer dependency. See wkhtmltopdf binary as composer dependencies for more information.

Attention! Please note that some dependencies (libXrender for example) may not be present on your system and may require manual installation.

Testing the wkhtmltopdf installation

After installing you should be able to run wkhtmltopdf from the command line / shell.

If you went for the second option the binaries will be at /vendor/h4cc/wkhtmltoimage-amd64/bin and /vendor/h4cc/wkhtmltopdf-amd64/bin.

Attention vagrant users!

Move the binaries to a path that is not in a synced folder, for example:

and make it executable:

This will prevent the error 126.

Package Installation

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

Laravel

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider/Facade. If you also use laravel-dompdf, watch out for conflicts. It could be better to manually register the Facade.

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

Optionally you can use the Facade for shorter code. Add this to your facades:

Finally you can publish the config file:

Snappy config file

The main change to this config file (config/snappy.php) will be the path to the binaries.

For example, when loaded with composer, the line should look like:

If you followed the vagrant steps, the line should look like:

For windows users you'll have to add double quotes to the bin path for wkhtmltopdf:

Lumen

In bootstrap/app.php add:

Optionally, add the facades like so:

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

Usage

You can create a new Snappy PDF/Image instance and load a HTML string, file or view name. You can save it to a file, or inline (show in browser) or download.

Using the App container:

Using the wrapper:

Or use the facade:

You can chain the methods:

You can change the orientation and paper size

If you need the output as a string, you can get the rendered PDF with the output() function, so you can save/output it yourself.

See the wkhtmltopdf manual for more information/settings.

Testing - PDF fake

As an alternative to mocking, you may use the PDF facade's fake method. When using fakes, assertions are made after the code under test is executed:

Other available assertions:

License

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


All versions of lara-snappy with dependencies

PHP Build Version
Package Version
Requires php Version >=7
illuminate/support Version ^5.5|^6|^7|^8
illuminate/filesystem Version ^5.5|^6|^7|^8
knplabs/knp-snappy Version ^1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package maximegratens/lara-snappy contains the following files

Loading the files please wait ....