PHPackages                             rainetro/laravel-imagebox - 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. [Database &amp; ORM](/categories/database)
4. /
5. rainetro/laravel-imagebox

ActiveLibrary[Database &amp; ORM](/categories/database)

rainetro/laravel-imagebox
=========================

Use images with Eloquent models in Laravel

0.1.8(2y ago)119MITPHPPHP ^8.1

Since Jun 4Pushed 2y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (10)Used By (0)

Laravel Image Box
=================

[](#laravel-image-box)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1eb9cf4233b0770a70bba8e246dd68741d3b522bc323b4101be261762917dfcc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7261696e6574726f2f6c61726176656c2d696d616765626f782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rainetro/laravel-imagebox)[![GitHub Tests Action Status](https://camo.githubusercontent.com/ecefecdc55df92e823440ae183818861c630e7307703451003e18954050431af/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7261696e6574726f2f6c61726176656c2d696d616765626f782f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/rainetro/laravel-imagebox/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/04b176403e1d045de94a1984a027a309297194c506de704a7c38c5caf47d2ad4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7261696e6574726f2f6c61726176656c2d696d616765626f782f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/rainetro/laravel-imagebox/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/973dcbb8131725133e2a245271c0070e9a5b1e9226b554225a9f956ed43cb2ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7261696e6574726f2f6c61726176656c2d696d616765626f782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rainetro/laravel-imagebox)

Use images with Eloquent models in Laravel. This package provides a simple way to attach images to Eloquent models to use in your web applications.

> This package is inspired by [spatie/laravel-medialibrary](https://github.com/spatie/laravel-medialibrary).

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

[](#installation)

You can install the package via composer:

```
composer require rainetro/laravel-imagebox
```

You can publish and run the migrations with:

```
php artisan vendor:publish --provider="Rainet\ImageBox\ImageBoxServiceProvider" --tag="migrations"
php artisan migrate
```

You can (optionally) publish the config file with:

```
php artisan vendor:publish --provider="Rainet\ImageBox\ImageBoxServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [
    'disk' => env('IMAGE_BOX_DISK', 'public'),
    'queue_connection_name' => env('QUEUE_CONNECTION', 'sync'),
    'queue_name' => '',
    'model' => \Rainet\ImageBox\Box\Models\Image::class,
    'folder_generator' => \Rainet\ImageBox\Box\FolderGenerator\DefaultFolderGenerator::class,
];
```

Usage
-----

[](#usage)

### Attach images to your models

[](#attach-images-to-your-models)

Ensure that your model implements the `ImageBoxInterface`. Add the `ImageBoxTrait` trait to the model. Implement the `registerImageCollections()` method. This method is used to define the image collections for your model. You can define one or more image collections by chaining the addImageCollection() method. Implement the `registerImageCollectionConversions()` method. This method is used to define the conversions for your image collections. Inside this method, you can chain the addConversion() method to add conversions to a specific image collection.

```
use Illuminate\Database\Eloquent\Model;
use Rainet\ImageBox\ImageBoxInterface;
use Rainet\ImageBox\ImageBoxTrait;

class Post extends Model implements ImageBoxInterface
{
    use ImageBoxTrait;

    //  ...

    public function registerImageCollections(): void
    {
        $this
            ->addImageCollection('image')
            ->acceptsMimeTypes(['image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp']);
    }

    public function registerImageCollectionConversions(): void
    {
        $this
            ->getImageCollection('image')
            ->addConversion('thumb')
            ->width(480)
            ->quality(90);

        // $this
        //     ->getImageCollection('image')
        //     ->addConversion('medium')
        //     ->width(600)
        //     ->height(600)
        //     ->quality(90);
    }
}
```

Use the `image` method to attach images to your model.

```
$post = Post::find(1);
$post
    ->addImage($request->file('image'))
    ->toCollection('image');
```

You can also use the `image()` or `images()` methods to retrieve the image(s).

```
$post->load('image');
$post->load('images');
```

Testing (Coming Soon)
---------------------

[](#testing-coming-soon)

We are actively working on implementing comprehensive testing for this package. Stay tuned for updates as we continue to improve the testing coverage.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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 ~3 days

Total

9

Last Release

1043d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/43358d4cc9b1d40ffdbd17bb725b1d2abdc8eb5e8b44cbbc0af8cfff0801bda2?d=identicon)[digitalserv](/maintainers/digitalserv)

---

Top Contributors

[![digitalserv](https://avatars.githubusercontent.com/u/6311195?v=4)](https://github.com/digitalserv "digitalserv (13 commits)")

---

Tags

laravelimagemodeleloquentimagebox

### Embed Badge

![Health badge](/badges/rainetro-laravel-imagebox/health.svg)

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

###  Alternatives

[plank/laravel-mediable

A package for easily uploading and attaching media files to models with Laravel

8271.5M11](/packages/plank-laravel-mediable)[qcod/laravel-imageup

Auto Image upload, resize and crop for Laravel eloquent model using Intervention image

775113.8k](/packages/qcod-laravel-imageup)[rob-lester-jr04/eloquent-sales-force

An eloquent model data source for Salesforce

94479.8k1](/packages/rob-lester-jr04-eloquent-sales-force)[shiftonelabs/laravel-cascade-deletes

Adds application level cascading deletes to Eloquent Models.

163632.1k2](/packages/shiftonelabs-laravel-cascade-deletes)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121130.3k](/packages/highsolutions-eloquent-sequence)[phaza/single-table-inheritance

Single Table Inheritance Trait

1515.8k](/packages/phaza-single-table-inheritance)

PHPackages © 2026

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