PHPackages                             mvaliolahi/attachable - 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. mvaliolahi/attachable

ActiveLibrary

mvaliolahi/attachable
=====================

This package allows you to attach files to Eloquent models.

1.0.4(3y ago)161MITPHP

Since Jul 14Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mvaliolahi/attachable)[ Packagist](https://packagist.org/packages/mvaliolahi/attachable)[ RSS](/packages/mvaliolahi-attachable/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (4)Versions (17)Used By (0)

Attach file to Laravel Eloquent
-------------------------------

[](#attach-file-to-laravel-eloquent)

### Installation

[](#installation)

```
$ composer require mvaliolahi/attachable
```

```
class Post extends Model
{
    use Attachable;

    protected $attachable = [
        'image',
        'cover'
    ];

    public function coverUrl()
    {
        return asset(Storage::url($this->cover));
    }
```

### Change upload path

[](#change-upload-path)

By default, files will be uploaded to the `public` directory, but you can change it by adding the `$upload_path` property to your model.

```
protected $upload_path = 'public';
```

### Separate files for each user

[](#separate-files-for-each-user)

This property is optional and allows each user's files to be saved in a separate folder.

```
protected $user_directory = true;
```

### Resize Images

[](#resize-images)

This property is optional.

```
protected $resize_image = [
    'avatar' => [
        'fit' => true, // default is false and will resize the image to the given size
        'width' => 200,
        'height' => 200,
        'quality' => 90 # this is optional, default is 100
        'resize_if_width' => 1024, // resize if width is greater than 1024
    ]
];
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Recently: every ~43 days

Total

16

Last Release

1279d ago

Major Versions

v0.0.11 → 1.0.02022-05-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d8a3eaee2623560bfdc9906358e1805abd4adf9fcd9170eba274fcfd8a51443?d=identicon)[mvaliolahi](/maintainers/mvaliolahi)

---

Top Contributors

[![mvaliolahi](https://avatars.githubusercontent.com/u/6920600?v=4)](https://github.com/mvaliolahi "mvaliolahi (17 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mvaliolahi-attachable/health.svg)

```
[![Health](https://phpackages.com/badges/mvaliolahi-attachable/health.svg)](https://phpackages.com/packages/mvaliolahi-attachable)
```

###  Alternatives

[bagisto/bagisto

Bagisto Laravel E-Commerce

26.2k161.6k7](/packages/bagisto-bagisto)[laravolt/avatar

Turn name, email, and any other string into initial-based avatar or gravatar.

2.0k5.4M31](/packages/laravolt-avatar)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[aimeos/aimeos-core

Full-featured e-commerce components for high performance online shops

4.5k346.9k48](/packages/aimeos-aimeos-core)[intervention/image-laravel

Laravel Integration of Intervention Image

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

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)

PHPackages © 2026

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