PHPackages                             smart-information-systems/file-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. smart-information-systems/file-bundle

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

smart-information-systems/file-bundle
=====================================

File bundle

v1.0(10y ago)158MIT

Since Mar 2Compare

[ Source](https://github.com/SmartInformationSystems/FileBundle)[ Packagist](https://packagist.org/packages/smart-information-systems/file-bundle)[ RSS](/packages/smart-information-systems-file-bundle/feed)WikiDiscussions Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Работа с файлами
================

[](#работа-с-файлами)

Требования:
-----------

[](#требования)

- php 7
- symfony 3

Установка
---------

[](#установка)

1. Прописать пакет и ссылку на репозиторий в `composer.json`

```
{
    // ...
    "require": {
        // ...
        "SmartInformationSystems/file-bundle": "dev-master"
    },
    "repositories": [
        {
            "type" : "vcs",
            "url" : "https://github.com/SmartInformationSystems/FileBundle.git"
        }
    ]
}
```

2. Включить бандл в `app/AppKernel.php`

```
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new SmartInformationSystems\FileBundle\SmartInformationSystemsFileBundle(),
            // ...
        );
    }
}
```

3. Прописать настройки в `app/config/config.yml`

```
smart_information_systems_file:
    storage:
        type: filesystem
        params:
            path: '%kernel.root_dir%/../web/storage'
            url: 'http://localhost/storage'
```

Использование
-------------

[](#использование)

### Добавление картинки в сущность

[](#добавление-картинки-в-сущность)

1. Добавляем поле в Entity

```
use SmartInformationSystems\FileBundle\Entity\Image;
use SmartInformationSystems\FileBundle\Annotations as Files;

class Brand
{
    /**
     * Логотип
     *
     * @var Image
     *
     * @ORM\OneToOne(targetEntity="SmartInformationSystems\FileBundle\Entity\Image", cascade="all")
     * @ORM\JoinColumn(name="logo_id", referencedColumnName="id", nullable=true)
     *
     * @Files\Image(
     *   width=370, height=210,
     *   previews={
     *     @Files\Image\Preview(name="admin", width=100, height=100),
     *   }
     * )
     */
    private $logo;
}
```

2. Применяем изменения в БД

`php binv/console doctrine:schema:update`

### Добавление коллекции картинок в сущность

[](#добавление-коллекции-картинок-в-сущность)

1. Добавляем новую сущность

```
use SmartInformationSystems\FileBundle\Entity\Image;
use SmartInformationSystems\FileBundle\Annotations as Files;

class ProductImage
{
    /**
     * Товар
     *
     * @var Product
     *
     * @ORM\ManyToOne(targetEntity="Product", inversedBy="images")
     * @ORM\JoinColumn(name="product_id", referencedColumnName="id", nullable=false)
     */
    private $good;

    /**
     * Изображение.
     *
     * @var Image
     *
     * @ORM\OneToOne(targetEntity="SmartInformationSystems\FileBundle\Entity\Image", cascade="all")
     * @ORM\JoinColumn(name="image_id", referencedColumnName="id", nullable=false)
     *
     * @Files\Image(
     *   width=700, height=700,
     *   previews={
     *     @Files\Image\Preview(name="admin", width=100, height=100, crop=true),
     *     @Files\Image\Preview(name="small", width=65, height=65, crop=true),
     *     @Files\Image\Preview(name="medium", width=250, height=250, crop=true)
     *   }
     * )
     */
    private $image;
}
```

2. Применяем изменения в БД

`php binv/console doctrine:schema:update`

### Вывод изображени в Sonata Admin

[](#вывод-изображени-в-sonata-admin)

#### Список элементов

[](#список-элементов)

1. Добавляем поле в Admin класс

```
class BrandAdmin extends AbstractAdmin
{
    $listMapper->add('logo', 'string', [
        'template' => 'SmartInformationSystemsFileBundle:sonata-admin:list_image.html.twig',
    ]);
}
```

#### Форма редактирования

[](#форма-редактирования)

1. Добавить шаблон в `app/config/config.yml`

```
twig:
    form_themes:
        - 'SmartInformationSystemsFileBundle:Form:fields.html.twig'
```

2. Добавить поле в Admin класс

```
use SmartInformationSystems\FileBundle\Form\Type\FileType;

class BrandAdmin extends AbstractAdmin
{
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper->add('logo', FileType::class, [
            'entity_class' => Brand::class,
            'data_class' => Image::class,
            'required' => false,
        ]);
    }
}
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3773d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3639369?v=4)[yk115](/maintainers/yk115)[@YK115](https://github.com/YK115)

---

Top Contributors

[![YK115](https://avatars.githubusercontent.com/u/3639369?v=4)](https://github.com/YK115 "YK115 (66 commits)")

---

Tags

file image

### Embed Badge

![Health badge](/badges/smart-information-systems-file-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/smart-information-systems-file-bundle/health.svg)](https://phpackages.com/packages/smart-information-systems-file-bundle)
```

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[sonata-project/media-bundle

Symfony SonataMediaBundle

4715.6M73](/packages/sonata-project-media-bundle)[contao/core-bundle

Contao Open Source CMS

1301.6M2.7k](/packages/contao-core-bundle)[vadymsemeniuk/yii2-file-processor-module

Extension to upload and store files

12299.9k](/packages/vadymsemeniuk-yii2-file-processor-module)[sahusoftcom/eloquent-image-mutator

One solution for image uploads.

12316.4k](/packages/sahusoftcom-eloquent-image-mutator)[czim/file-handling

File Handling Helper

15835.4k1](/packages/czim-file-handling)

PHPackages © 2026

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