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

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

nazka/attachment-bundle
=======================

Attach a file collection to Doctrine entities.

121PHP

Since Mar 15Pushed 12y ago1 watchersCompare

[ Source](https://github.com/jsampedro77/NazkaAttachmentBundle)[ Packagist](https://packagist.org/packages/nazka/attachment-bundle)[ RSS](/packages/nazka-attachment-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Nakza Attachment Bundle
=======================

[](#nakza-attachment-bundle)

Attach a collection of files to any Doctrine entity. Features include:

- Easy attach files to an entity using Trait.
- Configurable Security provider for each entity with attachments.
- Controller to list, view and download attachments
- Thumbnail generation for images and video (optional). Can create your own thumnail generators.
- File uploads with VichUploader and KnpGaufrette

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

[](#installation)

Create a composer.json in your projects root-directory:

```
{
    "require": {
        "nazka/attachment-bundle": "*"
    }
}

```

and run:

```
curl -s http://getcomposer.org/installer | php
php composer.phar install

```

Temporally, you have to configure Gaufrette and VichUploader. This we be automatically done in future.

in config.yml

```
knp_gaufrette:
    adapters:
        attachment_adapter:
            local:
                directory: %kernel.root_dir%/../private/attachments
    filesystems:
        attachment_fs:
            adapter:    attachment_adapter

vich_uploader:
    db_driver: orm
    gaufrette: true
    storage: nazka_attachment.storage.gaufrette
    mappings:
        attachment:
            upload_destination: attachment_fs
            inject_on_load: false

```

This parameter must be created to have video thumnails generated by ffmpeg, set to false if you want to disable:

```
nazka_attachment_ffmpeg_path: /usr/bin/ffmpeg

```

Usage
-----

[](#usage)

Your entity should use HasAttachmentsTrait, this way it will also implemente HasAttachmentsInterface.

```
