github mpdf/mpdf v8.1.0
Version 8.1.0 released

latest releases: v8.2.3, v8.2.2, v8.2.1...
2 years ago

Version 8.1.0 contains cleanups, fixes, a few code refactorings most importantly leading to a new experimental feature of internal services container.

Note: as this is an experimental feature, key names and interface names for container services can and will change in future versions.

Container

A new optional parameter has been added to the Mpdf class constructor. It expects an instance of \Mpdf\Container\ContainerInterface (which is compatible and in mPDF 10.0 will be replaced by proper PSR-11 ContainerInterface), which can now override two internal services: HTTP client, and local filesystem resource loader.

HTTP Client

The Mpdf\Http\ClientInterface, also compatible with and planned to be upgraded to PSR-7 HTTP Client, can be used by the httpClient key of the passed Container and used to restrict remote HTTP calls, implementing HTTP requests cache, altering incoming responses etc. With a simple bridge, it can be used to leverage already used HTTP client in an existing application, such as Guzzle or Symfony HTTP Client.

By default, a simple implementation based on curl (if available) or sockets (as a fallback) is used.

Local filesystem content loader

The simple Mpdf\File\LocalContentLoaderInterface is used to load local content. Custom implementation by the container key localContentLoader can implement restrictions for certain directories of the filesystem to prevent outside HTML code loading unwanted files. Default implementation uses a simple file_get_contents call.

Unwanted stream wrappers are handled for all local and remote content fetches in an encapsulating internal service.

Support our work

Thank you for any work you put into mPDF - refactorings, bug fixes, new feature requests.

We also welcome any donation.

Yaaay! 22 million (!) downloads 🎉!

Hope number of downloads will keep rising!

Don't miss a new mpdf release

NewReleases is sending notifications on new releases.