PHPackages                             lakshanjs/jpegmini-sdk - 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. [Image &amp; Media](/categories/media)
4. /
5. lakshanjs/jpegmini-sdk

ActiveLibrary[Image &amp; Media](/categories/media)

lakshanjs/jpegmini-sdk
======================

A PHP SDK wrapper for the JPEGmini CLI image optimizer.

1171—0%PHP

Since Mar 28Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

🧠 JPEGmini PHP SDK
==================

[](#-jpegmini-php-sdk)

A lightweight, production-ready PHP SDK wrapper for the [JPEGmini Server CLI](https://jpegmini.com/products/developers/aws/docs). It allows you to optimize JPEG images via command line directly from PHP, with support for resizing, quality settings, metadata removal, and more.

---

📦 Installation
--------------

[](#-installation)

Install using Composer:

```
composer require lakshanjs/jpegmini-sdk
```

---

🚀 Quick Start
-------------

[](#-quick-start)

```
use LakshanJS\Jpegmini\JpegminiSDK;

$jpegmini = new JpegminiSDK('/usr/local/bin/jpegmini');

$result = $jpegmini->optimize('/path/to/input.jpg', [
    'output' => '/path/to/output.jpg',
    'resize' => '60',
    'quality_mode' => 1,
    'remove_metadata' => true,
    'skip_high_compression' => false
]);

print_r($result);
```

---

⚙️ Options
----------

[](#️-options)

OptionTypeDescription`output``string`File or folder path where the optimized image(s) should be saved. If omitted, JPEGmini saves to the same folder as the input, appending `_mini` to the filename.`recursive``bool`When optimizing a folder, determines whether subdirectories should be processed. Default: `true``logfile``string`Path to save JPEGmini logs (same as CLI `-logfile`)`log_level``int`CLI log verbosity: `0` (none), `1` (basic), `2` (verbose). Default: `1``csvfile``string`Path to save CSV summary of optimization results`resize``string`Resize before optimization. Format: `'50'` (percentage) or `'800x600'` (fixed size)`quality_mode``int`Output quality: `0` (best), `1` (high), `2` (medium). Default: `0``skip_high_compression``bool`Skips images already heavily compressed. Default: `true``remove_metadata``bool`Removes EXIF and other metadata from JPEG files. Default: `false`---

📝 Examples
----------

[](#-examples)

### ➕ Optimize and Save with New Name

[](#-optimize-and-save-with-new-name)

```
$jpegmini->optimize('/images/photo.jpg', [
    'output' => '/images/photo_compressed.jpg',
]);
```

### 🔄 Overwrite Original File (⚠️ Destructive)

[](#-overwrite-original-file-️-destructive)

```
$jpegmini->optimize('/images/photo.jpg', [
    'output' => '/images/photo.jpg'
]);
```

### 🧩 Resize &amp; Remove Metadata

[](#-resize--remove-metadata)

```
$jpegmini->optimize('/images/original.jpg', [
    'resize' => '800x600',
    'remove_metadata' => true
]);
```

### 📁 Optimize Entire Folder (Recursively)

[](#-optimize-entire-folder-recursively)

```
$jpegmini->optimize('/images/uploads', [
    'recursive' => true
]);
```

---

✅ Requirements
--------------

[](#-requirements)

- PHP 7.4 or higher
- JPEGmini Server installed and accessible via CLI
- Executable binary path (e.g. `/usr/local/bin/jpegmini`)

---

📄 License
---------

[](#-license)

MIT License — free for commercial and personal use.

---

🙋‍♂️ Author
-----------

[](#‍️-author)

**Lakshan Jayasinghe**
[GitHub @lakshanjs](https://github.com/lakshanjs)

---

📬 Contributing
--------------

[](#-contributing)

Pull requests and suggestions are welcome! If you want to add Laravel integration, batch queue support, or auto-backup before overwrite, feel free to fork or raise an issue.

---

💡 Tip
-----

[](#-tip)

This SDK doesn’t use any HTTP calls or external services — it's a direct wrapper around the JPEGmini CLI. It’s ideal for secure, offline image processing systems.

---

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7646f42a475b03098fb92e7dbec224cfabc712ac70950ee0b7337b361036d994?d=identicon)[lakshanjs](/maintainers/lakshanjs)

---

Top Contributors

[![lakshanjs](https://avatars.githubusercontent.com/u/7899504?v=4)](https://github.com/lakshanjs "lakshanjs (2 commits)")

### Embed Badge

![Health badge](/badges/lakshanjs-jpegmini-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/lakshanjs-jpegmini-sdk/health.svg)](https://phpackages.com/packages/lakshanjs-jpegmini-sdk)
```

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[char0n/ffmpeg-php

PHP wrapper for FFmpeg application

495225.1k1](/packages/char0n-ffmpeg-php)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)

PHPackages © 2026

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