PHPackages                             2lenet/attachment-bundle - 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. 2lenet/attachment-bundle

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

2lenet/attachment-bundle
========================

Attachment

1.2.1(5y ago)16.7k↓86.1%MITJavaScriptPHP &gt;=7.2CI failing

Since Oct 23Pushed 5y ago6 watchersCompare

[ Source](https://github.com/2lenet/AttachmentBundle)[ Packagist](https://packagist.org/packages/2lenet/attachment-bundle)[ RSS](/packages/2lenet-attachment-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (2)Versions (20)Used By (0)

AttachmentBundle
================

[](#attachmentbundle)

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

[](#installation)

`composer req 2lenet/attachment-bundle`

Add to your config/routes.yaml ( no flex reciepe for the moment ).

```
lle_attachment:
    resource: "@LleAttachmentBundle/Resources/config/routing/routes.yaml"
```

Embed controller in a template
------------------------------

[](#embed-controller-in-a-template)

```
{{ render(controller('lle.attachment', {'item': item})) }}
```

Or with field if you want only an group of attachment

```
{{ render(controller('lle.attachment', {'item': item, options: {'field': 'pdf'}})) }}
```

Like that you can use "lle.attachment" action with EasyAdminPlusBundle:

```
show:
    title: title.examen.show
    fields:
        - { type: 'tab', id: 'documents', label: 'tab.documents', action: 'lle.attachment'}
```

Or with field if you want only an group of attachment

```
show:
    title: title.examen.show
    fields:
        - { type: 'tab', id: 'documents', label: 'tab.documents', action: 'lle.attachment', options: {'field': 'pdf'}}
```

Information: the lle.attachment is a alias of lle.attachment.show.action

Easy use
--------

[](#easy-use)

render the widget for upload:

```
{{ render_attachment(entity) }}
```

render the list (ul) for download:

```
{{ list_attachment(entity) }}
```

You can use several attachment on the same template

```
{{ render_attachment(item) }}

{%  for examen in item.examens  %}
    {{ examen }}
    {{ render_attachment(examen) }}
{%  endfor %}
```

Configurations
--------------

[](#configurations)

with default value

```
framework:
    translator:
        fallbacks: ['fr']

lle_attachment:
    directory: data/attachment #directory of files is registred
    show_list: false #show or not show the list of files (table) with uploader widget
    need_confirm_remove: true #modal for confirm delete or no
```

Thanks to use

pre load for list of entities:
------------------------------

[](#pre-load-for-list-of-entities)

If you list 20 entities with 20 call of {{ list\_attachment(entity) }} you want 1 request not 20:

call

```
