PHPackages                             brainx2/file-fileentitybundle - 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. brainx2/file-fileentitybundle

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

brainx2/file-fileentitybundle
=============================

01.2k2PHP

Since Jan 27Pushed 11y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

FileEntityBundle
================

[](#fileentitybundle)

Simple way to upload files

Installation:
-------------

[](#installation)

Pretty simple with [Composer](http://packagist.org), add:

```
{
    "require": {
        "brainx2/file-fileentitybundle": "1.0.0.*@dev"
    }
}
```

### Add FileEntityBundle to your application kernel

[](#add-fileentitybundle-to-your-application-kernel)

```
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Brainx2\File\FileEntityBundle\Brainx2FileFileEntityBundle(),
        // ...
    );
}
```

Usage examples:
---------------

[](#usage-examples)

### ORM.yml

[](#ormyml)

```
Demo\BackendBundle\Entity\Demo:
    type:  entity
    table: demo
    id:
        id:
            type: integer
            generator:
                strategy: AUTO
    fields:
        name:
            type: string
            length: 50
        image_first:
            type: string
            length: 255
            nullable: true
        image_second:
            type: string
            length: 255
            nullable: true

    lifecycleCallbacks:
        prePersist: [upload]
        preUpdate: [upload]
        preRemove: [remove]
```

### Entity

[](#entity)

```
namespace Demo\BackendBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Brainx2\File\FileEntityBundle\Entity\FileEntity as FileEntity;

/**
 * Demo
 */
class Demo extends FileEntity
{
    /**
     * @var integer
     */
    private $id;

    /**
     * @var string
     */
    private $name;

    /**
     * @var string
     */
    protected $image_first;

    /**
     * @var string
     */
    protected $image_second;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Demo
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set image_first
     *
     * @param string $imageFirst
     * @return Demo
     */
    public function setImageFirst($imageFirst)
    {
        if(!is_null($imageFirst)) {
            $this->setFiles('image_first');

            $this->image_first = $imageFirst;
        }

        return $this;
    }

    /**
     * Get image_first
     *
     * @return string
     */
    public function getImageFirst()
    {
        return $this->image_first;
    }

    /**
     * Set image_second
     *
     * @param string $imageSecond
     * @return Demo
     */
    public function setImageSecond($imageSecond)
    {
        if(!is_null($imageSecond)) {
            $this->setFiles('image_second');

            $this->image_second = $imageSecond;
        }

        return $this;
    }

    /**
     * Get image_second
     *
     * @return string
     */
    public function getImageSecond()
    {
        return $this->image_second;
    }

    /**
     * @ORM\PrePersist
     * @ORM\PreUpdate
     */
    public function upload()
    {
        return parent::upload();
    }

    /**
     * @ORM\PreRemove
     */
    public function remove()
    {
        $this->setFiles('image_first');
        $this->setFiles('image_second');

        return parent::remove();
    }

    protected function getUploadRootDir()
    {
        return __DIR__.'/../../../../../web/'.$this->getUploadDir();
    }

    protected function getUploadDir()
    {
        return '/uploads/files';
    }
}
```

### Form

[](#form)

```
class DemoType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name')
            ->add('image_first', 'file', array(
                'required' => false,
                'data_class' => null
            ))
            ->add('image_second', 'file', array(
                'required' => false,
                'data_class' => null
            ))
        ;
    }

    //.......
}
```

### View

[](#view)

```

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5be06dde81edd94f3d5ff2cea2074087f24e1c4640e11f89e9828bd4f1153144?d=identicon)[brainx2](/maintainers/brainx2)

---

Top Contributors

[![brainx2](https://avatars.githubusercontent.com/u/10219394?v=4)](https://github.com/brainx2 "brainx2 (17 commits)")

### Embed Badge

![Health badge](/badges/brainx2-file-fileentitybundle/health.svg)

```
[![Health](https://phpackages.com/badges/brainx2-file-fileentitybundle/health.svg)](https://phpackages.com/packages/brainx2-file-fileentitybundle)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15161.6M2.6k](/packages/illuminate-filesystem)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)[madnest/madzipper

Easier zip file handling for Laravel applications.

1382.3M6](/packages/madnest-madzipper)

PHPackages © 2026

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