PHPackages                             bnbwebexpertise/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. bnbwebexpertise/laravel-attachments

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

bnbwebexpertise/laravel-attachments
===================================

Attach files to your models, retrievable by key, group name or using the Eloquent relationship.

1.0.27(1y ago)89211.0k↑65.4%34[3 issues](https://github.com/bnbwebexpertise/laravel-attachments/issues)1MITPHPPHP &gt;=7.0

Since Feb 21Pushed 1y ago11 watchersCompare

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

READMEChangelog (10)Dependencies (9)Versions (47)Used By (1)

Laravel 5.x file attachment helpers
===================================

[](#laravel-5x-file-attachment-helpers)

This package allows to quickly attach files to your models, retrievable by key, group name or using the Eloquent relationship.

> Can also be installed on Laravel 5.4, [see below](#older-laravel-54-install)

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

[](#installation)

You can install this package via composer. Laravel 5.5+ auto discovers the service provider.

```
composer require bnbwebexpertise/laravel-attachments

```

### Older Laravel 5.4 install

[](#older-laravel-54-install)

For 5.4 support install version 0.0.16 :

```
composer require bnbwebexpertise/laravel-attachments:0.0.16

```

Then add the service provider to your configuration :

```
'providers' => [
        // ...

        Bnb\Laravel\Attachments\AttachmentsServiceProvider::class,

        // ...
],
```

Configuration
-------------

[](#configuration)

You can customize this package behavior by publishing the configuration file :

```
php artisan vendor:publish --provider='Bnb\Laravel\Attachments\AttachmentsServiceProvider'

```

Add attachments to a model class
--------------------------------

[](#add-attachments-to-a-model-class)

Add the `HasAttachment` trait to your model class :

```
