PHPackages                             mezcalito/sylius-file-upload-plugin - 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. mezcalito/sylius-file-upload-plugin

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

mezcalito/sylius-file-upload-plugin
===================================

Mezcalito file upload plugin for Sylius.

0.5.0(1y ago)614.6k↓33.3%7MITPHPPHP ^8.2CI failing

Since May 7Pushed 1y ago4 watchersCompare

[ Source](https://github.com/Mezcalito/SyliusFileUploadPlugin)[ Packagist](https://packagist.org/packages/mezcalito/sylius-file-upload-plugin)[ RSS](/packages/mezcalito-sylius-file-upload-plugin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (31)Versions (5)Used By (0)

Mezcalito Sylius File Upload Plugin
===================================

[](#mezcalito-sylius-file-upload-plugin)

This plugin works almost the same as the standard Sylius images uploading (see [How to add images to an entity?](https://docs.sylius.com/en/latest/cookbook/images/images-on-entity.html) from the Sylius Documentation), except that it accepts any kind of file types.

Initially this was proposed as a pull request on Sylius core, but it was declined as it was not backwards compatible with Sylius 1.x (Here is the [link to the initial PR](https://github.com/Sylius/Sylius/pull/9224)), so here it is as a Sylius plugin.

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

[](#installation)

First require this package with composer

```
$ composer require mezcalito/sylius-file-upload-plugin
```

Then add the bundle to your `config/bundles.php` file

```
// bundles.php

return [
    // ...
    Mezcalito\SyliusFileUploadPlugin\MezcalitoSyliusFileUploadPlugin::class => ['all' => true],
];
```

In your `config/packages/_sylius.yaml` file, add the following

```
# config/packages/_sylius.yaml
imports:
    - { resource: "@MezcalitoSyliusFileUploadPlugin/Resources/config/app/config.yml" }
```

> This file defines the gaufrette `filesystem` and `adapter` used by the plugin, which you can override.

Usage
-----

[](#usage)

> This section is an adaptation of the official Sylius documentation about [How to add images to an entity ?](https://docs.sylius.com/en/latest/cookbook/images/images-on-entity.html).
>
> Extending entities with an `files` field is quite a popular use case. In this cookbook we will present how to **add files to the Shipping Method entity**.

you can see this sample in test/Application.

### 1. Create the book class with the FilesAwareInterface

[](#1-create-the-book-class-with-the-filesawareinterface)

```
# src/entity/book.php
