PHPackages                             rpwebdevelopment/has-image-laravel - 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. rpwebdevelopment/has-image-laravel

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

rpwebdevelopment/has-image-laravel
==================================

A package for simplifying image handling on Laravel eloquent models

1.0.1(1mo ago)03↓50%MITPHPPHP ^8.4CI failing

Since Jun 18Pushed 1mo agoCompare

[ Source](https://github.com/rpwebdevelopment/has-image-laravel)[ Packagist](https://packagist.org/packages/rpwebdevelopment/has-image-laravel)[ Docs](https://github.com/rpwebdevelopment/has-image-laravel)[ GitHub Sponsors](https://github.com/rpwebdevelopment)[ RSS](/packages/rpwebdevelopment-has-image-laravel/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (1)Dependencies (9)Versions (2)Used By (0)

A package for simplifying image handling on Laravel eloquent models
===================================================================

[](#a-package-for-simplifying-image-handling-on-laravel-eloquent-models)

[![Packagist Version](https://camo.githubusercontent.com/8c073244f3cd50bf69316b96bfc121bb3cb06893538f6faee5aaeb02dde5f6a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7270776562646576656c6f706d656e742f6861732d696d6167652d6c61726176656c)](https://camo.githubusercontent.com/8c073244f3cd50bf69316b96bfc121bb3cb06893538f6faee5aaeb02dde5f6a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7270776562646576656c6f706d656e742f6861732d696d6167652d6c61726176656c)[![Packagist Downloads](https://camo.githubusercontent.com/524dd6ccfbf66543e1a689a991dbf85793833ef90c0296b8522530077521cba9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7270776562646576656c6f706d656e742f6861732d696d6167652d6c61726176656c)](https://camo.githubusercontent.com/524dd6ccfbf66543e1a689a991dbf85793833ef90c0296b8522530077521cba9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7270776562646576656c6f706d656e742f6861732d696d6167652d6c61726176656c)[![License: MIT](https://camo.githubusercontent.com/0d72c4cb15193b9e2e0f21dfc6ce0c8a1f49edd2719e2f9550808afd5e329576/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c756576696f6c65742e737667)](https://github.com/rpwebdevelopment/has-image-laravel/blob/main/LICENSE.md)

The `has-image-laravel` package is designed to be a lightweight package to simplify image handling on Laravel models, currently rather than having to handle uploaded files in your controllers, usually leading to significant code duplication.

This package allows for image upload handling (including SVG sanitization) on models to be quickly and easily configured.

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

[](#installation)

You can install the package via composer:

```
composer require rpwebdevelopment/has-image-laravel
```

You can publish the config file with:

```
php artisan vendor:publish --tag="has-image-laravel-config"
```

The config file dictates the default storage disk to be used, while this can be overridden at a model level you may find it useful to configure to your default disk:

```
return [
    'default' => 'local',
];
```

Usage
-----

[](#usage)

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use RPWebDevelopment\HasImageLaravel\Dto\ImageDetails;
use RPWebDevelopment\HasImageLaravel\Traits\HasImage;

class Foo extends Model
{
    use HasImage;

    protected $fillable = [
        ...
        'logo',
        ...
    ];

    public function getImageDetails(): ImageDetails
    {
        /**
        * $storageDisk parameter is optional, if excluded the
        * default disk from your configuration will be accepted.
        *
        * $maintainFilename parameter is optional (false by default)
        * if true, the uploaded file will maintain the original filename
        * as uploaded. If false a hashed filename will be used.
        */
        return ImageDetails::create(
            imageDirectory: 'DIR_NAME',
            imageFields: ['logo'],
            storageDisk: 'public',
            maintainFilename: true
        );
    }
}
```

Changelog
---------

[](#changelog)

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

Credits
-------

[](#credits)

- [Richard Porter](https://github.com/rpwebdevelopment)

License
-------

[](#license)

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

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance90

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

Unknown

Total

1

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f90bae5abe02b9035a5dec46c9e0d4d45e957eacaf740cfe79ed239e8fbeb808?d=identicon)[rpwebdevelopment](/maintainers/rpwebdevelopment)

---

Top Contributors

[![rpwebdevelopment](https://avatars.githubusercontent.com/u/15613749?v=4)](https://github.com/rpwebdevelopment "rpwebdevelopment (3 commits)")

---

Tags

laravelrpwebdevelopmenthas-image-laravel

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/rpwebdevelopment-has-image-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/rpwebdevelopment-has-image-laravel/health.svg)](https://phpackages.com/packages/rpwebdevelopment-has-image-laravel)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k107.5M1.6k](/packages/spatie-laravel-permission)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.2k12.6M122](/packages/dedoc-scramble)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k5.4M49](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329575.9k33](/packages/codewithdennis-filament-select-tree)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

24773.9k](/packages/harris21-laravel-fuse)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

25060.1k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

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