PHPackages                             groovili/rest-uploader-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. [HTTP &amp; Networking](/categories/http)
4. /
5. groovili/rest-uploader-bundle

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

groovili/rest-uploader-bundle
=============================

A Symfony bundle to handle file upload and management for REST API

1.0.0(8y ago)62052MITPHPPHP &gt;=7.1CI failing

Since Jan 14Pushed 6y ago2 watchersCompare

[ Source](https://github.com/groovili/RestUploaderBundle)[ Packagist](https://packagist.org/packages/groovili/rest-uploader-bundle)[ Docs](https://github.com/groovili/RestUploaderBundle)[ RSS](/packages/groovili-rest-uploader-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (8)Versions (3)Used By (0)

RestUploaderBundle
==================

[](#restuploaderbundle)

[![Latest Stable Version](https://camo.githubusercontent.com/a5253682f546095d4da470459b18d0ef11c1f6d26e967c50c07a0342415769d5/68747470733a2f2f706f7365722e707567782e6f72672f67726f6f76696c692f726573742d75706c6f616465722d62756e646c652f762f737461626c65)](https://packagist.org/packages/groovili/rest-uploader-bundle)[![Total Downloads](https://camo.githubusercontent.com/0d3dc5182973531d9dcec5bf55c6f2e89dae53fcee54e86c2587969075d65269/68747470733a2f2f706f7365722e707567782e6f72672f67726f6f76696c692f726573742d75706c6f616465722d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/groovili/rest-uploader-bundle)[![License](https://camo.githubusercontent.com/fb1c944f0f3ada517009cfefefb823c8c0f928476a34b679a15e87409a279f58/68747470733a2f2f706f7365722e707567782e6f72672f67726f6f76696c692f726573742d75706c6f616465722d62756e646c652f6c6963656e7365)](https://packagist.org/packages/groovili/rest-uploader-bundle)

A **Symfony bundle** for file upload and management **for REST API**.

Provides `File` entity, `rest_uploader.manager`,`rest_uploader.validator` services, `RestFileType` and list of **events to subscribe**:

1. `rest_uploader.file.preUpload`
2. `rest_uploader.file.postUpload`
3. `rest_uploader.file.preDownload`
4. `rest_uploader.file.preDelete`
5. `rest_uploader.file.preGetPath`

Examples can be found in examples section below.

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

[](#installation)

Require the `groovili/rest-uploader-bundle` package in your **composer.json** and update your dependencies.

```
composer require groovili/rest-uploader-bundle

```

Add the **RestUploaderBundle** to your application's kernel:

```
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Groovili\RestUploaderBundle\RestUploaderBundle(),
            // ...
        ];
        // ...
    }
```

Please notice that `csrf_protection` should be `false` to use **RestFileType**.

Configuration
-------------

[](#configuration)

The `public_dir` and `private_dir` are path strings from **app** folder. If not exist, would be added automatically. This parameters should be only strings.

`allowed_extensions` is array of strings with allowed file extensions.

`file_max_size` is integer number in MB, which would be maximum limit.

Configuration which provided below is default for this bundle:

```
    rest_uploader:
        public_dir: '../web/files'
        private_dir: '../private'
        allowed_extensions: []
        file_max_size: 25
```

Examples
--------

[](#examples)

RestFileType for file upload

```
