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

ActiveLibrary

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

A package for simplifying image handling on Laravel eloquent models

1.0.1(yesterday)03↑2900%MITPHPPHP ^8.4CI failing

Since Jun 18Pushed yesterdayCompare

[ 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 today

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

42

—

FairBetter than 89% of packages

Maintenance100

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

1d 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.9k98.0M1.3k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.3M42](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k9.9M89](/packages/dedoc-scramble)[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M152](/packages/spatie-laravel-health)[spatie/laravel-passkeys

Use passkeys in your Laravel app

463755.5k32](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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