Intervention Image
Fluent PHP image processing with interchangeable GD, Imagick, and libvips drivers
Repository Health
Technical Analysis
Intervention Image is a PHP library for creating, editing, and composing images through a single fluent, expressive API that abstracts over the underlying image-processing engine. It ships driver implementations for GD and Imagick out of the box (with libvips available as a separate driver package), so the same application code can run on whichever extension is available in a given environment.
As one of the most widely adopted PHP image libraries, it’s a common dependency in Laravel and other PHP frameworks for tasks like resizing uploads, generating thumbnails, watermarking, and format conversion, including support for animated image formats across all drivers.
What You Get
- An
ImageManagerthat lets you swap between GD, Imagick, or libvips without changing application code - A fluent
ImageAPI for resizing, cropping, rotating, watermarking, and drawing text/shapes - Format encoders/decoders covering JPEG, PNG, WebP, AVIF, GIF (including animated), and more
- A
Colorsmodule supporting multiple color spaces and palette extraction - Typography support for rendering text onto images with custom fonts
- A driver-agnostic
Interfaceslayer so third parties can implement additional backends
Common Use Cases
- Resizing and generating thumbnails for user-uploaded images in a web application
- Adding watermarks or logos to images before serving or storing them
- Converting between image formats (e.g. JPEG/PNG to WebP or AVIF) for optimized delivery
- Editing animated GIFs (resize, crop) while preserving frame-by-frame animation
- Extracting dominant colors or generating image-based text overlays for dynamic content
Under The Hood
Architecture The library follows a driver-abstraction pattern: ImageManager::usingDriver() selects a concrete driver class (src/Drivers/Gd/Driver.php or src/Drivers/Imagick/Driver.php) that implements a shared Interfaces contract, while operations on an Image instance are expressed as Modifiers objects executed through a ModifierStack, and file I/O flows through separate Decoders/Encoders pipelines per format — this keeps format- and engine-specific logic isolated from the fluent public API surface. Tech Stack Pure PHP 8.3+ targeting the Intervention\Image PSR-4 namespace, depending on intervention/gif for animated GIF support and optionally the ext-gd/ext-imagick/ext-exif PHP extensions depending on which driver is active; dev tooling includes PHPUnit 12, PHPStan for static analysis, and PHP CodeSniffer with Slevomat coding standards. Code Quality Tests are split into tests/Unit and tests/Feature directories (plus tests/Traits and tests/Providers helpers), run via phpunit.dist.xml, alongside a phpstan.dist.neon config enforcing static-analysis strictness — a testing and analysis setup consistent with a widely-depended-on library. API Design The fluent, chainable Image API ($image->scale(...)->insert(...)->encodeUsingFormat(...)) keeps common tasks to a few lines of code with named parameters for clarity, and the driver-agnostic design means switching from GD to Imagick requires no code changes beyond the ImageManager::usingDriver() call, which is a strong developer-experience win for portability across hosting environments.
Used by 6 apps in this directory
Akaunting
Invoicing Finance
Open-source online accounting for small businesses and freelancers — invoices, expenses, and reporting without monthly fees or vendor lock-in.
Bagisto
Analytics · Ecommerce
Open-source Laravel eCommerce platform for building multi-vendor marketplaces, B2B stores, headless commerce, and AI-powered storefronts.
Crater
Invoicing Finance
Open source invoicing and billing platform for freelancers and small businesses — create estimates, track expenses, accept Stripe payments, and run recurring invoices from your own server.
Invoice Ninja
Invoicing Finance · Project Management
Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.
Mixpost
Marketing · Social Media
Self-host your own social media scheduler and publish to 11 platforms without subscriptions or data lock-in.
Yaffa
Invoicing Finance
Self-hosted personal finance app for long-term financial planning with AI-powered transaction parsing and investment tracking.