PHPackages                             davidcb/laravel-shortpixel - 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. davidcb/laravel-shortpixel

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

davidcb/laravel-shortpixel
==========================

Laravel 5+ package for ShortPixel API integration

0.3.2(2y ago)615.9k↓39.7%4[1 PRs](https://github.com/davidcb/laravel-shortpixel/pulls)MITPHP

Since Oct 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/davidcb/laravel-shortpixel)[ Packagist](https://packagist.org/packages/davidcb/laravel-shortpixel)[ Docs](https://github.com/davidcb/laravel-shortpixel)[ RSS](/packages/davidcb-laravel-shortpixel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

Laravel-Shortpixel
==================

[](#laravel-shortpixel)

Laravel 5+ wrapper for ShortPixel API

- [Laravel-Shortpixel on Packagist](https://packagist.org/packages/davidcb/laravel-shortpixel)
- [Laravel-Shortpixel on GitHub](https://github.com/davidcb/laravel-shortpixel)

Installation
------------

[](#installation)

Install via Composer:

```
composer require davidcb/laravel-shortpixel

```

If you're using Laravel &gt;= 5.5, you can skip this as this package will be auto-discovered. Add the service provider to `config/app.php`

```
Davidcb\LaravelShortPixel\LaravelShortPixelServiceProvider::class,
```

You can register the facade in the `aliases` array in the `config/app.php` file

```
'LaravelShortPixel' => Davidcb\LaravelShortPixel\Facades\Esendex::class,
```

Publish the config file

```
$ php artisan vendor:publish --provider="Davidcb\LaravelShortPixel\LaravelShortPixelServiceProvider"

```

Set your API key on your .env file

```
SHORT_PIXEL_API_KEY=secret

```

Usage
-----

[](#usage)

You can find all the methods in the original [short-pixel-optimizer/shortpixel-php package](https://github.com/short-pixel-optimizer/shortpixel-php).

Examples:

```
// From URL
$result = LaravelShortPixel::fromUrls('https://your.site/img/unoptimized.png', '/path/to/save/to'[, 'filename.png', $compression_level = 1, $width = 200, $height = 200, $maxDimension = true]);
```

```
// From file
$result = LaravelShortPixel::fromFiles('/path/to/your/local/unoptimized.png', '/path/to/save/to'[, $compression_level = 1, $width = 200, $height = 200, $maxDimension = true]);
```

```
// From files
$result = LaravelShortPixel::fromFiles(array('/path/to/your/local/unoptimized.png', '/path/to/your/local/unoptimized2.png'), '/path/to/save/to'[, $compression_level = 1, $width = 200, $height = 200, $maxDimension = true]);
```

```
// From folder
$result = LaravelShortPixel::fromFolder('/path/to/your/local/folder', '/path/to/save/to'[, $compression_level = 1, $width = 200, $height = 200, $maxDimension = true]);
```

The compression\_level, width, height and maxDimension are optional. Compression levels are 0 - loseless, 1 - lossy, 2- glossy. Default compression level for your images is set on the configuration file (lossy is set as default).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% 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 ~455 days

Total

5

Last Release

959d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ce03708704fe42ae8d751798a0ce05f851f12b6d18ee501d5ba493b9263d8d9?d=identicon)[davidcb](/maintainers/davidcb)

---

Top Contributors

[![davidcb](https://avatars.githubusercontent.com/u/1170269?v=4)](https://github.com/davidcb "davidcb (10 commits)")[![Komesz](https://avatars.githubusercontent.com/u/18665310?v=4)](https://github.com/Komesz "Komesz (3 commits)")[![Cajs](https://avatars.githubusercontent.com/u/6383356?v=4)](https://github.com/Cajs "Cajs (1 commits)")

---

Tags

laravelimageoptimizationintegrationshortpixel

### Embed Badge

![Health badge](/badges/davidcb-laravel-shortpixel/health.svg)

```
[![Health](https://phpackages.com/badges/davidcb-laravel-shortpixel/health.svg)](https://phpackages.com/packages/davidcb-laravel-shortpixel)
```

###  Alternatives

[joshembling/image-optimizer

Optimize your Filament images before they reach your database.

111145.4k12](/packages/joshembling-image-optimizer)[danihidayatx/image-optimizer

Optimize your Filament images before they reach your database. Forked from joshembling/image-optimizer for Filament v4 &amp; v5 support.

254.4k](/packages/danihidayatx-image-optimizer)

PHPackages © 2026

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