PHPackages                             van-ons/laravel-attachment-library - 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. van-ons/laravel-attachment-library

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

van-ons/laravel-attachment-library
==================================

A Laravel library for attaching files to Eloquent models.

v1.2.5(1mo ago)22.9k↓30%[1 PRs](https://github.com/VanOns/laravel-attachment-library/pulls)1MITPHPPHP ^8.2CI passing

Since May 10Pushed 1mo agoCompare

[ Source](https://github.com/VanOns/laravel-attachment-library)[ Packagist](https://packagist.org/packages/van-ons/laravel-attachment-library)[ Docs](https://github.com/VanOns/laravel-attachment-library)[ RSS](/packages/van-ons-laravel-attachment-library/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (27)Used By (1)

[![Social card of Laravel Attachment Library](art/social-card.png)](art/social-card.png)

Laravel Attachment Library
==========================

[](#laravel-attachment-library)

[![Latest version on GitHub](https://camo.githubusercontent.com/ba60b37afc4403b0f05551a003ddbb6d777a63652638ed3bd355a9dc099d9fb1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f56616e4f6e732f6c61726176656c2d6174746163686d656e742d6c6962726172792e7376673f7374796c653d666c61742d737175617265)](https://github.com/VanOns/laravel-attachment-library/releases)[![Total downloads](https://camo.githubusercontent.com/d46b6f2f0721e3c69ad16ca242de1b8d7aff76f8c06b2b07d032b939b499578b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76616e2d6f6e732f6c61726176656c2d6174746163686d656e742d6c6962726172792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/van-ons/laravel-attachment-library)[![GitHub issues](https://camo.githubusercontent.com/9659259f4864b30e761c365be83d1f53f2f3023a21469dc717f4b0ff5b9cb87b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f56616e4f6e732f6c61726176656c2d6174746163686d656e742d6c6962726172793f7374796c653d666c61742d737175617265)](https://github.com/VanOns/laravel-attachment-library/issues)[![License](https://camo.githubusercontent.com/0616bab52c835db0369df7860c00273fa4cc900e9337bcd105e27d95f7fb957b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f56616e4f6e732f6c61726176656c2d6174746163686d656e742d6c6962726172793f7374796c653d666c61742d737175617265)](https://github.com/VanOns/laravel-attachment-library/blob/main/LICENSE.md)

A Laravel library for attaching files to Eloquent models.

Quick start
-----------

[](#quick-start)

### Installation

[](#installation)

The Laravel Attachment Library can be installed using Composer by running the following command:

```
$ composer require van-ons/laravel-attachment-library
```

After downloading the dependency, run the following command to install all the migrations and assets:

```
$ php artisan attachment-library:install
```

### Usage

[](#usage)

To enable file attachments in your Eloquent models, add the `HasAttachments` trait to your model class:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use VanOns\LaravelAttachmentLibrary\Concerns\HasAttachments;

class ModelName extends Model
{
    use HasAttachments;

    // ...
}
```

After that you should be able to link attachments to your model as follows:

```
// Retrieve attachment.
$attachment = \VanOns\LaravelAttachmentLibrary\Models\Attachment::find($attachmentId);

// Retrieve your model.
$myModel = ModelName::find($modelId);

// Link attachment to your model.
$myModel->attachments()->attach($attachment);
```

Documentation
-------------

[](#documentation)

Please see the [documentation](docs/README.md#contents) for detailed information about installation and usage.

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

[](#contributing)

Please see [contributing](CONTRIBUTING.md) for more information about how you can contribute.

Changelog
---------

[](#changelog)

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

Upgrading
---------

[](#upgrading)

Please see [upgrading](UPGRADING.md) for more information about how to upgrade.

Security
--------

[](#security)

Please see [security](SECURITY.md) for more information about how we deal with security.

Credits
-------

[](#credits)

We would like to thank the following contributors for their contributions to this project:

- [All Contributors](../../contributors)

License
-------

[](#license)

The scripts and documentation in this project are released under the [MIT License](LICENSE.md).

---

[![Logo of Van Ons](https://camo.githubusercontent.com/f233e4b012f8d6bded619dbeb286cf4d9c5fbe2789456e8c4495d3c0fae66b1f/68747470733a2f2f6f70656e736f757263652e76616e2d6f6e732e6e6c2f66696c65732f636f772e706e67)](https://van-ons.nl/)

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance89

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~15 days

Total

19

Last Release

55d ago

Major Versions

v0.0.8 → v1.0.0-rc12025-09-25

### Community

Maintainers

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

---

Top Contributors

[![dangelodelano](https://avatars.githubusercontent.com/u/26794861?v=4)](https://github.com/dangelodelano "dangelodelano (80 commits)")[![dnwjn](https://avatars.githubusercontent.com/u/57711725?v=4)](https://github.com/dnwjn "dnwjn (73 commits)")[![mauricewijnia](https://avatars.githubusercontent.com/u/8679682?v=4)](https://github.com/mauricewijnia "mauricewijnia (14 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![KianAcquoy](https://avatars.githubusercontent.com/u/118724608?v=4)](https://github.com/KianAcquoy "KianAcquoy (4 commits)")

---

Tags

attachmentseloquentlaravellaraveleloquentmodelsattachments

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/van-ons-laravel-attachment-library/health.svg)

```
[![Health](https://phpackages.com/badges/van-ons-laravel-attachment-library/health.svg)](https://phpackages.com/packages/van-ons-laravel-attachment-library)
```

###  Alternatives

[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[mopo922/laravel-treats

A collection of goodies for Laravel 5.

108451.6k1](/packages/mopo922-laravel-treats)[lacodix/laravel-model-filter

A Laravel package to filter, search and sort models with ease while fetching from database.

17649.9k](/packages/lacodix-laravel-model-filter)[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

15828.6k](/packages/relaticle-custom-fields)[giacomomasseron/laravel-models-generator

Generate Laravel models from an existing database

484.2k](/packages/giacomomasseron-laravel-models-generator)[pursehouse/modeler-laravel-eloquent

Generate model classes for Eloquent in Laravel

112.4k](/packages/pursehouse-modeler-laravel-eloquent)

PHPackages © 2026

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