Download the PHP package trianity/laravel-pdf-viewer without Composer

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

Trianity Laravel PDF Viewer

A secure PDF.js based PDF viewer for Laravel 13+, Livewire 4 and Tailwind CSS 4.

This package provides a reusable PDF viewer component without relying on WordPress, Joomla or remote PDF URL loading.

Features

Requirements

Installation

Publish the configuration when you need to customize the package:

Publish the viewer asset when you want to include or customize the JavaScript entry manually:

Import the viewer asset from your Vite entrypoint.

For example, if the published asset is located at resources/js/vendor/pdf-viewer.js:

Then rebuild your frontend assets:

Configuration

The package configuration is published to:

Important options include:

Use either a Gate ability or an authorization callback when your application needs explicit access control.

Resolver

The package never accepts arbitrary PDF URLs.

Instead, bind PdfDocumentResolver in your application and resolve trusted document IDs to storage metadata:

A typical application resolver may query an Eloquent model, check ownership or tenancy boundaries, and then return the storage disk, path, safe filename and MIME type.

Usage

Use the Blade component:

You can also render the Livewire component directly:

The height option accepts simple CSS length values such as:

Invalid values fall back to 70vh.

Viewer theme

The theme option controls only the viewer interface and toolbar. It does not change, invert or recolor the rendered PDF page.

Supported values:

Explicit light, soft and dark themes are isolated from the browser/OS color scheme as far as possible. This helps keep the viewer controls readable when the host page uses a different visual background than the global dark/light mode.

The soft theme is recommended for light or pastel landing pages. The theme option affects only the viewer interface; it does not modify the rendered PDF page or canvas.

Invalid values fall back to auto.

Tailwind CSS 4

If your application uses Tailwind CSS 4, make sure Tailwind scans the package Blade views.

Add this to your application CSS entrypoint, for example resources/css/app.css:

Then rebuild your frontend assets:

Authorization

Configure config/pdf-viewer.php with either a Gate ability or an authorization callback.

Using a Gate ability:

Using an authorization callback:

The callback receives the resolved PdfDocument, so your application can authorize access using your own Gate, Policy, tenancy or ownership rules.

If neither gate nor authorize is configured, the package assumes that your resolver only returns documents that the current request is allowed to access.

Security Model

Testing

The package uses Pest, Orchestra Testbench, Laravel Pint and Larastan.

The quality command runs formatting, static analysis and the test suite.

Versioning

This package follows semantic versioning.

The current Light/free version focuses on a secure PDF.js based viewer.

The following features are intentionally not included in the first release:

License

The MIT License.


All versions of laravel-pdf-viewer with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/contracts Version ^13.0
illuminate/filesystem Version ^13.0
illuminate/routing Version ^13.0
illuminate/support Version ^13.0
livewire/livewire Version ^4.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 trianity/laravel-pdf-viewer contains the following files

Loading the files please wait ...