PHPackages                             mostafaznv/pdf-optimizer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. mostafaznv/pdf-optimizer

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

mostafaznv/pdf-optimizer
========================

PDF optimization tool for PHP and Laravel applications

1.2.6(3mo ago)170125.8k↓14.3%11[1 PRs](https://github.com/mostafaznv/pdf-optimizer/pulls)MITPHPPHP ^8.2CI passing

Since Jan 16Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/mostafaznv/pdf-optimizer)[ Packagist](https://packagist.org/packages/mostafaznv/pdf-optimizer)[ RSS](/packages/mostafaznv-pdf-optimizer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (13)Used By (0)

PDF Optimizer
=============

[](#pdf-optimizer)

[![GitHub Workflow Status](https://camo.githubusercontent.com/fcdcd789c22d34f03a71dc33cb001b069bbfdcbe13c9137032ce035e1a9e11f1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f73746166617a6e762f7064662d6f7074696d697a65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d4275696c64267374796c653d666c61742d737175617265266c6f676f3d676974687562)](https://github.com/mostafaznv/pdf-optimizer/actions)[![Codecov branch](https://camo.githubusercontent.com/20b3f676034934e74d98031338a8da217b420a391d64a331c43bea9561d5817f/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6d6f73746166617a6e762f7064662d6f7074696d697a65722f6d61696e2e7376673f7374796c653d666c61742d737175617265266c6f676f3d636f6465636f76)](https://app.codecov.io/gh/mostafaznv/pdf-optimizer)[![Quality Score](https://camo.githubusercontent.com/416ce0126baeb4b6cfc376f2a823418032a3a13b0f09adf5439c7433fa318f03/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d6f73746166617a6e762f7064662d6f7074696d697a65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/mostafaznv/pdf-optimizer)[![GitHub license](https://camo.githubusercontent.com/39dc84b697182216131754c2ef8890ee711570bed46f0a8a0dc26fa0de773d95/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6f73746166617a6e762f7064662d6f7074696d697a65723f7374796c653d666c61742d737175617265)](https://github.com/mostafaznv/pdf-optimizer/blob/main/LICENSE)[![Packagist Downloads](https://camo.githubusercontent.com/3052c9e6a74de6ad21ec6d3df3f24385ed74d9b850f1b8d2b164f69e8c4d3da8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f73746166617a6e762f7064662d6f7074696d697a65723f7374796c653d666c61742d737175617265266c6f676f3d7061636b6167697374)](https://packagist.org/packages/mostafaznv/pdf-optimizer)[![Latest Version on Packagist](https://camo.githubusercontent.com/916fdbc6ce9a14032dd8e8cf43ffe6a890140e1fdb1dac1a87ebf414f57b6817/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f73746166617a6e762f7064662d6f7074696d697a65722e7376673f7374796c653d666c61742d737175617265266c6f676f3d636f6d706f736572)](https://packagist.org/packages/mostafaznv/pdf-optimizer)

`PDF Optimizer` stands as a robust PHP package meticulously crafted for effortless optimization and compression of PDF files. Whether you are engaged in a `standalone PHP` project or navigating the `Laravel` landscape, pdf-optimizer emerges as a powerful solution, utilizing the well-known `ghostscript` tool to significantly reduce PDF file sizes.

[![Donate](https://camo.githubusercontent.com/0b7607d470e0ccaa24269275d40233442275a42b0a714b4875bccf62f6ed5295/68747470733a2f2f6d6f73746166617a6e762e6769746875622e696f2f646f6e6174652f646f6e6174652e737667)](https://mostafaznv.github.io/donate)

### Key Features

[](#key-features)

- **Fluent Method Chaining:** Experience the elegance of a fluent and expressive API that seamlessly optimizes PDF files. Harness the power of nearly all ghostscript options with ease.
- **Logger Support:** Capture detailed logs to gain profound insights into the intricacies of the optimization process. Stay informed and in control with the integrated logger.
- **Customization:** Tailor the optimization process to your exact needs. pdf-optimizer provides a customizable solution, allowing you to fine-tune your PDF optimization experience.
- **Laravel Integration:** Specifically designed for Laravel applications, pdf-optimizer supports diverse input methods, including `file paths`, `UploadedFile` instances, and `disk` storage. This guarantees flexibility and user-friendly integration within the Laravel ecosystem.
- **Queue Support:** Elevate your optimization process with asynchronous PDF file optimization using Laravel queues. pdf-optimizer seamlessly integrates with Laravel's queue system, ensuring efficient background processing.

### Documentation

[](#documentation)

You can find installation instructions and detailed instructions on how to use this package at the [dedicated documentation site.](https://mostafaznv.gitbook.io/pdf-optimizer)

Warning

#### License Notice

[](#license-notice)

This package is licensed under the [MIT](LICENSE) License.

It **does not** include the Ghostscript. However, it requires Ghostscript to be installed on the server in order to function. Ghostscript is licensed separately under the **AGPL** or a **commercial license** from Artifex. If you choose the AGPL version of Ghostscript, you **must** comply with the AGPL terms in your own application.

Please ensure you have the appropriate Ghostscript license for your use case.

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance82

Actively maintained with recent releases

Popularity50

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 95.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~76 days

Recently: every ~88 days

Total

11

Last Release

93d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c87c061fb40fecc29bc1082fb31465ac6909045de815b44632beef415f1aeee?d=identicon)[mostafaznv](/maintainers/mostafaznv)

---

Top Contributors

[![mostafaznv](https://avatars.githubusercontent.com/u/7619687?v=4)](https://github.com/mostafaznv "mostafaznv (70 commits)")[![ara303](https://avatars.githubusercontent.com/u/769754?v=4)](https://github.com/ara303 "ara303 (1 commits)")[![illambo](https://avatars.githubusercontent.com/u/1899805?v=4)](https://github.com/illambo "illambo (1 commits)")[![jdecool](https://avatars.githubusercontent.com/u/433926?v=4)](https://github.com/jdecool "jdecool (1 commits)")

---

Tags

ghostscriptpdfpdf-compressorpdf-optimizertiny-pdfphplaravelpdfghostscriptmostafaznvpdf-compressorpdf-optimizercompress-pdftiny-pdf

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/mostafaznv-pdf-optimizer/health.svg)

```
[![Health](https://phpackages.com/badges/mostafaznv-pdf-optimizer/health.svg)](https://phpackages.com/packages/mostafaznv-pdf-optimizer)
```

###  Alternatives

[mpdf/mpdf

PHP library generating PDF files from UTF-8 encoded HTML

4.7k77.1M493](/packages/mpdf-mpdf)[imal-h/pdf-box

The most advanced, driver-based PDF manipulation library for PHP v3.0. Supports Ghostscript, Chrome Headless (HTML to PDF), OpenSSL/FPDI (Signing), and PDFtk (Forms).

60403.9k](/packages/imal-h-pdf-box)[pontedilana/php-weasyprint

PHP library allowing PDF generation from an url or a html page. Wrapper for Kozea/WeasyPrint.

761.1M7](/packages/pontedilana-php-weasyprint)[renatio/dynamicpdf-plugin

October HTML to PDF converter using dompdf library.

3113.4k3](/packages/renatio-dynamicpdf-plugin)[nilgems/laravel-textract

A Laravel package to extract text from files like DOC, XL, Image, Pdf and more. I've developed this package by inspiring "npm textract".

195.2k](/packages/nilgems-laravel-textract)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
