Download the PHP package pxlrbt/laravel-pdfable without Composer

On this page you can find all versions of the php package pxlrbt/laravel-pdfable. 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 laravel-pdfable

Laravel Pdfable

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Keep the logic for your PDFs in one place like you do with Laravel's Mailables.

Installation

You can install the package via composer:

You can publish the config file with:

Optionally, you can publish the views using

Configuration

Currently two drivers are supported:

Browsershot Driver

This is the default driver and requires spatie/browsershot. Please follow the installation instructions for that package.

You can configure the Browsershot driver via BrowsershotDriver::configureUsing() in your AppServiceProvider:

Wkhtmltopdf Driver

To use the wkhtmlpdf Driver, make sure wkhtmltopdf is installed on your system and globally available.

Then, set the PDFABLE_DRIVER option in your .env file to wkhtmltopdf.

Generating Pdfables

You can use the make command to generate a Pdfable class and view.

Usage

You can directly use, pass or return Pdfables in many places in your app.

As Files

You can store Pdfables via ->store() method. This will use outputFile() method on the class to determine the class name. Optionally, you can pass a custom filename.

As Responses

You can either stream, download or return your Pdfables HTML for debugging.

HTML

To return HTML in a debugging view, just return the Pdfable.

Stream

To stream your Pdfable, add the ->stream() method.

Download

To download your Pdfable, add the ->download() method. Optionally, you can also override the filename from here.

As Mailable Attachment

To use a Pdfable as a mail attachment, just pass it via ->attach(). Make sure your mailables/notifications are queued for faster processing.

As Jobs

Pdfs can take some time to create, so you can queue your Pdfables and create them in the background with the known Laravel methods.

Writing Pdfables

Once you have generated a pdfable class, open it up so we can explore its contents. Pdfable class configuration is done in several methods.

Configuring The View

The view is configured via static $view property.

Configuring The Page/Layout

You can return a Page object to configure the PDF page size, orientation and margins.

Passing Additional Data

Pass additional data via the constructor of your Pdfable for later use.

Accessing Data From View

Similar to Laravel's Blade Components you can access properties and public methods directly from your view file.

Configuring The Output File

When saving a Pdfable to the disk, you can provide a default path via filename() and override the default disk via $disk property.

Queuing A Pdfable

Pdfables implement ShouldQueue and therefore can be pushed to a queue via Invoice::dispatch(). You can also use other queue configuration methods directly on your Pdfable like backoff(), retryUntil(), uniqueId(), ...

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-pdfable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
spatie/laravel-package-tools Version ^1.13.0
illuminate/contracts Version ^9.0|^10.0|^11.0
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 pxlrbt/laravel-pdfable contains the following files

Loading the files please wait ....