PHPackages                             digit-soft/laravel-attachments - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. digit-soft/laravel-attachments

ActiveLibrary[File &amp; Storage](/categories/file-storage)

digit-soft/laravel-attachments
==============================

File attachments for laravel.

1.3.6(3mo ago)03.8k1MITPHPPHP ^8.1CI failing

Since Oct 21Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/digit-soft/laravel-attachments)[ Packagist](https://packagist.org/packages/digit-soft/laravel-attachments)[ RSS](/packages/digit-soft-laravel-attachments/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (25)Used By (0)

Attach files to Eloquent models
-------------------------------

[](#attach-files-to-eloquent-models)

This package gives you models, traits and some examples for attaching files to any Eloquent model and write down those usages. Also provides use of private files (downloaded through framework with user token).

Possible flow:

1. You upload a file
2. Create `Attachment` model for this file
3. Write down usage of this attachment by your model

If you delete this model, usage will be deleted. If you reSave your model with another attachment - usage will be deleted.

Unused attachments can be deleted by running cleanup (@see `Facades/Attachments`).

Uploaded images can be automatically resized to max size given in config, there is a `job` for that.

See `AttachmentManager` for further usage.

Made for `Rest API` projects. Ideally must be controller for file upload and another one for download (private files). Controller examples are in `src/Controllers` directory.

There is also image processing controller example, which uses hexadecimal encoded width/height data, it is resizing images on the fly and puts resized images to the cache folder. You can use NGINX, for example, to download cached image next time.

### Traits

[](#traits)

You can found usable model traits in `src/Traits` directory. They use an observer for save/delete events.

- `HasAttachments` - General trait for use withing model
- `HasAttachmentById` - trait for model with single `attachment_id` field

### Console

[](#console)

#### Create migration

[](#create-migration)

You can create DB migration for `Attachment` models by running artisan command:

```
php artisan attachments:tables
```

#### Create directories fo files

[](#create-directories-fo-files)

Command will create directories for attachments save/publishing.

```
php artisan attachments:directories
```

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance80

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 97.7% 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 ~83 days

Recently: every ~164 days

Total

24

Last Release

105d ago

Major Versions

0.5.1 → 1.0.02020-10-21

0.5.3 → v1.x-dev2021-04-09

PHP version history (5 changes)0.5.1PHP &gt;=7.1

v1.x-devPHP &gt;=7.3

1.0.5PHP ^7.4|^8.0

1.1.0PHP ^8.0

1.2.1PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11768817?v=4)[Volodymyr Kovalenko](/maintainers/digitv)[@digitv](https://github.com/digitv)

---

Top Contributors

[![digitv](https://avatars.githubusercontent.com/u/11768817?v=4)](https://github.com/digitv "digitv (130 commits)")[![DevMoroh](https://avatars.githubusercontent.com/u/9556569?v=4)](https://github.com/DevMoroh "DevMoroh (3 commits)")

---

Tags

filesattachments

### Embed Badge

![Health badge](/badges/digit-soft-laravel-attachments/health.svg)

```
[![Health](https://phpackages.com/badges/digit-soft-laravel-attachments/health.svg)](https://phpackages.com/packages/digit-soft-laravel-attachments)
```

###  Alternatives

[league/flysystem-memory

In-memory filesystem adapter for Flysystem.

8533.6M194](/packages/league-flysystem-memory)[league/flysystem-async-aws-s3

AsyncAws S3 filesystem adapter for Flysystem.

2610.5M31](/packages/league-flysystem-async-aws-s3)

PHPackages © 2026

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