PHPackages                             f-bahesna/intervention-image-wrapper - 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. f-bahesna/intervention-image-wrapper

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

f-bahesna/intervention-image-wrapper
====================================

Simple Laravel wrapper for Intervention Image v3.

v1.0.6(5mo ago)29MITPHPPHP ^8.1

Since Nov 25Pushed 5mo agoCompare

[ Source](https://github.com/f-bahesna/intervention-image-wrapper)[ Packagist](https://packagist.org/packages/f-bahesna/intervention-image-wrapper)[ RSS](/packages/f-bahesna-intervention-image-wrapper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (7)Used By (0)

Intervention Image Wrapper for Laravel
======================================

[](#intervention-image-wrapper-for-laravel)

A **lightweight Laravel wrapper** around [Intervention Image v3](https://image.intervention.io/) that provides a fluent, clean API to **upload, resize, crop, convert, and store images** easily across multiple disks (local, S3, OSS, etc.).

It is designed sometimes to remember me about simplify image handling tasks in Laravel projects while keeping performance and code clarity.

---

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

[](#installation)

```
composer require f-bahesna/intervention-image-wrapper

# Publish config (optional)
php artisan vendor:publish --provider="Fbahesna\InterventionImageWrapper\ImageWrapperServiceProvider" --tag="imagewrapper-config"
```

---

Configuration (`config/imagewrapper.php`)
-----------------------------------------

[](#configuration-configimagewrapperphp)

```
return [
    'disk' => env('IMAGE_WRAPPPER_DISK', 'public'),
    'quality' => env('IMAGE_WRAPPER_QUALITY', 85),
    'tmp_dir' => env('IMAGE_WRAPPER_TMP', sys_get_temp_dir()),
    'intervention' => [
        'driver' => env('IMAGE_WRAPPER_DRIVER', 'gd'), // or 'imagick'
    ],
];
```

---

1) Manually Upload &amp; Resize ❌
---------------------------------

[](#1-manually-upload--resize-)

```
use Intervention\Image\ImageManager;
use Illuminate\Support\Facades\Storage;

$manager = new ImageManager(['driver' => 'gd']);
$image = $manager->make($request->file('avatar')->getPathname())
    ->resize(300, 300);

$filename = 'avatars/1.jpg';
Storage::disk('public')->put($filename, (string) $image->encode('jpg', 85));

$url = Storage::disk('public')->url($filename);
```

**Pain points**:

- Lots of boilerplate code (managing `$manager`, encoding, storage).
- Manual handling of `resize`, `encode`, and `disk`.

---

2) Upload &amp; Resize **using `Intervention Image Wrapper`** ✅
---------------------------------------------------------------

[](#2-upload--resize-using-intervention-image-wrapper-)

```
use Fbahesna\InterventionImageWrapper\Facades\ImageWrapper;

$url = ImageWrapper::load($request->file('avatar'))
    ->resize(300, 300)
    ->store('avatars/1.jpg');
```

**Advantages**:

- **Fluent &amp; chainable** API (`load()->resize()->store()`).
- Automatically handles **storage disk** and encoding.
- Easier **unit testing** with `Orchestra\Testbench`.
- Optional helper function `imagewrap()` for even cleaner syntax.
- **Consistent quality &amp; file naming** across the app.

---

### 2. a) Using helper for even cleaner code ✅ ✅

[](#2-a-using-helper-for-even-cleaner-code--)

```
$url = imagewrap()->load($request->file('avatar'))
    ->fit(200, 200)
    ->store('avatars/photo.webp');
```

- Quick one-liner without repeating `$manager` or storage logic.

### 2. b) Using DI (dependency injection) ✅ ✅

[](#2-b-using-di-dependency-injection--)

```
use Fbahesna\InterventionImageWrapper\Services\ImageWrapperService;

class avatarController {
    public function __construct(private ImageWrapperService $imageWrapper)
    {
    }

    public function upload(Request $request)
    {
        $url = $this->imageWrapper
            ->load($request->file('file'))
            ->resize(400, 400)
            ->store('avatars/image.jpg');

        return response()->json(['url' => $url]);
    }
}
```

Usage Examples
--------------

[](#usage-examples)

### Basic upload &amp; resize

[](#basic-upload--resize)

```
use Fbahesna\InterventionImageWrapper\Facades\ImageWrapper;

$url = ImageWrapper::load($request->file('avatar'))
    ->resize(300, 300)
    ->store('avatars/1.jpg');
```

### Resize Image

[](#resize-image)

```
$image->resize(800, 600);
```

### Crop

[](#crop)

```
$image->crop(300, 300, x: 50, y: 20);
```

### Rotate

[](#rotate)

```
$image->rotate(90);
```

### Blur

[](#blur)

```
$image->blur(10);
```

### Brightness

[](#brightness)

```
$image->brightness(20);
```

### Delete an image

[](#delete-an-image)

```
ImageWrapper::delete('images/photo.jpg');
```

---

Advantages
----------

[](#advantages)

1. **Fluent &amp; intuitive API**: Chain operations like resize, fit, crop, rotate, and store.
2. **Supports multiple filesystems**: Works with `local`, `s3`, `oss`, or any Flysystem disk.
3. **Lightweight**: Minimal wrapper over Intervention Image v3 — no heavy dependencies.
4. **Reusable &amp; testable**: Can be easily tested with PHPUnit &amp; Testbench.
5. **Laravel integration**: Auto-discovered service provider and optional helper function.
6. **Flexible configuration**: Set default disk, quality, temporary directory, and driver in config.

---

---

Testing
-------

[](#testing)

Use [Orchestra Testbench](https://github.com/orchestral/testbench) to run PHPUnit tests:

```
vendor/bin/phpunit
```

---

Contribution
------------

[](#contribution)

PRs welcome. Please follow standard Laravel package conventions:

- PSR-4 autoloading: `Fbahesna\InterventionImageWrapper\`
- Run PHPUnit tests for every feature added.
- Keep the package lightweight and simple.

---

**Summary Table:**

FeatureRaw Intervention ImageUsing ImageWrapperSetup Manager✅ manual✅ autoResize / Fit✅ manual✅ chainableEncode &amp; quality✅ manual✅ automaticStore to disk✅ manual✅ automaticFluent API❌✅Reusable in controllers❌ harder✅ easyUnit Testing❌ harder✅ supported with TestbenchHelper function❌✅ optional `imagewrap()`---

###  Health Score

36

—

LowBetter than 81% of packages

Maintenance76

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~1 days

Total

6

Last Release

158d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d43dbe8944228b09173731f6dc0a9ec91ace4164bd5299e97567115f2aa17e18?d=identicon)[f-bahesna](/maintainers/f-bahesna)

---

Top Contributors

[![f-bahesna](https://avatars.githubusercontent.com/u/35018212?v=4)](https://github.com/f-bahesna "f-bahesna (17 commits)")

---

Tags

image-interventionlaravel-intervention-image

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/f-bahesna-intervention-image-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/f-bahesna-intervention-image-wrapper/health.svg)](https://phpackages.com/packages/f-bahesna-intervention-image-wrapper)
```

###  Alternatives

[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M100](/packages/intervention-image-laravel)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k22](/packages/bkwld-croppa)[devfactory/imagecache

Laravel package for generating thumbnails of images and caching them in your public files folder.

1620.3k](/packages/devfactory-imagecache)[spatie/laravel-og-image

Generate OG images for your Laravel app

305.2k](/packages/spatie-laravel-og-image)[freearhey/laravel-face-detection

A Laravel Package for Face Detection and Cropping in Images.

392.2k](/packages/freearhey-laravel-face-detection)[flowframe/laravel-drift

128.7k](/packages/flowframe-laravel-drift)

PHPackages © 2026

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