PHPackages                             laravelir/attachmentable - 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. laravelir/attachmentable

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

laravelir/attachmentable
========================

A package for attachment files to models

0.2.5(3y ago)4281MITPHPPHP &gt;=7.4|^8.0

Since Oct 16Pushed 9mo ago2 watchersCompare

[ Source](https://github.com/laravelir/attachmentable)[ Packagist](https://packagist.org/packages/laravelir/attachmentable)[ Docs](https://github.com/laravelir/attachmentable)[ Fund](https://idpay.ir/laravelir)[ RSS](/packages/laravelir-attachmentable/feed)WikiDiscussions master Synced 1mo ago

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

- [![Starts](https://camo.githubusercontent.com/a9ea8a5b4360764d0072d881330057d722fc54543ecb2ea97466d811a6e4e4dd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6c61726176656c69722f6174746163686d656e7461626c653f7374796c653d666c6174266c6f676f3d676974687562)](https://github.com/laravelir/attachmentable/forks)
- [![Forks](https://camo.githubusercontent.com/bd51265db95304095593f91791c606398f4a616027d8dff21cf2dc22bd01a526/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6c61726176656c69722f6174746163686d656e7461626c653f7374796c653d666c6174266c6f676f3d676974687562)](https://github.com/laravelir/attachmentable/stargazers)

Laravel attachmentable package
==============================

[](#laravel-attachmentable-package)

A package for attachment files to models

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

[](#installation)

1. Run the command below to add this package:

```
composer require laravelir/attachmentable

```

2. Open your config/attachmentable.php and add the following to the providers array:

```
Laravelir\Attachmentable\Providers\AttachmentableServiceProvider::class,
```

3. Run the command below to install package:

```
php artisan attachmentable:install

```

4. Run the command below to migrate database:

```
php artisan migrate

```

Uses
----

[](#uses)

First add `Attachmentable` trait to models that you want have attachments

```
namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Laravelir\Attachmentable\Traits\Attachmentable;

class Post extends Model
{
    use HasFactory,
        Attachmentable;
}
```

and add `Attachmentorable` trait to User models

```
namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Laravelir\Attachmentable\Traits\Attachmentorable;

class User extends Model
{
    use HasFactory,
        Attachmentorable;
}
```

### Methods

[](#methods)

in controllers, with `Attachmentable` trait you have these methods:

```
namespace App\Http\Controllers;

use App\Models\Post;

class PostController extends Controller
{
    public function index()
    {
        $file = request()->file('thumbnail');

        $post = Post::find(1);

        $post->attach($file, "posts/thumbnails");

        $post->attachments // return all attachments

        $post->attachment($id); // return attachment

        $post->detach($id);

        $post->clearAttachments();

    }
}
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance40

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community9

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

Every ~77 days

Recently: every ~124 days

Total

8

Last Release

1128d ago

### Community

Maintainers

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

---

Top Contributors

[![miladimos](https://avatars.githubusercontent.com/u/31257147?v=4)](https://github.com/miladimos "miladimos (27 commits)")

---

Tags

eloquentfilesystemlaravellaravel-attachmentablelaravel-modellaravel-packagelaravel-uploaderphplaravellaravel-packagelaravel-packageslumen packageslumen supportLaravel-Supportlaravel uploadlaravel fileattachmentablelaravel-attachmentable

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laravelir-attachmentable/health.svg)

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

###  Alternatives

[irazasyed/larasupport

Adds Laravel Package Support in Lumen.

130669.8k4](/packages/irazasyed-larasupport)[lwwcas/laravel-countries

A comprehensive package for managing country data in Laravel applications, including multilingual support, geographic coordinates, and detailed metadata for seamless integration with Laravel.

12464.0k](/packages/lwwcas-laravel-countries)[salehhashemi/laravel-repository

Implementing the repository pattern for Laravel projects.

2010.5k](/packages/salehhashemi-laravel-repository)

PHPackages © 2026

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