wearejust/image-optim-bundle
A Symfony bundle for optimizing images through configurable filters and processors. Integrates with Symfony's service container to compress, resize, and cache uploaded images, with Twig helpers and support for multiple image drivers. Lightweight and framework-native.
First, calibrate expectations: wearejust/image-optim-bundle is a Symfony bundle, not a Laravel package, last released in September 2017, archived, with 1 star and 0 dependents. There is no service provider, no facade, no config/image-optim.php to publish. If you are on Laravel, treat this as reference source code, not a dependency.
Minimal evaluation path:
README.md → composer.json (PHP/Symfony constraints) → DependencyInjection/Configuration.php (what is actually configurable) → Resources/config/services.* (what the container wires up) → Command/ and any EventSubscriber/ or EventListener/.jpegoptim, optipng, pngquant, or the macOS-only imageoptim). The README will name it; if it doesn't, grep the source for exec, shell_exec, Process, or Symfony\Component\Process.composer require it into a Laravel app. Clone it into a scratch Symfony skeleton only if you genuinely need to see it run, or just read the source.The realistic takeaway from "Getting Started" is: you are reading this to learn the shape of an image-optimization integration, not to install it.
What the bundle does (or was intended to do) in Symfony terms, translated to how you would actually use it day-to-day:
StoreUploadedImage action class.OptimizeImageJob) that runs the binary and replaces the file or writes a derived version. The original bundle's event-listener style maps cleanly onto a Laravel queued listener.Command/ directory is the most portable idea: iterate a directory, skip already-optimized files (by mtime or a hash sidecar), run the binary, log failures. In Laravel this becomes an artisan command over a Storage disk, ideally chunked and resumable.config/image-optim.php and read them via config(). Keep defaults conservative (quality ~80–85, lossless for PNG where possible) and make them per-format.services.yaml with your own implementation. In Laravel the equivalent is binding an interface to your own class and ignoring the bundle entirely.A pragmatic Laravel-native shape, if you are lifting ideas:
App\Services\ImageOptimizer with an optimize(string $absolutePath): void method that shells out via Symfony\Component\Process\Process (usable in Laravel).App\Jobs\OptimizeImage queued job wrapping it, with $tries and $backoff.php artisan images:optimize {disk} {path} command for backfill.That is roughly 100 lines and will be maintainable in a way this bundle will not be.
composer require will likely fail on modern PHP constraints anyway.ImageOptimServiceProvider, no facade, no publishable config. Any "installation" instructions in the README are Symfony AppKernel/bundles.php steps you cannot follow directly.optipng/jpegoptim/imageoptim is not on the server, you get silent no-ops or opaque process exceptions. Verify the binary exists and is executable at deploy time (a health-check route or a boot-time assertion), not at first user upload.Storage::path() differs per driver; S3 has no local path at all. If you need S3, the binary approach breaks down — you must download to a temp file, optimize, re-upload. Plan for that explicitly.sys_get_temp_dir()). This is the most common production failure.spatie/image-optimizer (wraps the same binaries, actively maintained, framework-agnostic), intervention/image (manipulation + encoding, not binary-based), or a hosted API (TinyPNG, Cloudflare Images, imgix) if you want to offload the problem entirely. For pure "shrink what I uploaded," spatie/image-optimizer is the direct replacement.How can I help you explore Laravel packages today?