PHPackages                             zotyo/u-filer - 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. zotyo/u-filer

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

zotyo/u-filer
=============

Manage file uploads

v1.1.0(8y ago)051MITPHPPHP &gt;=5.5.0

Since Oct 17Pushed 8y ago1 watchersCompare

[ Source](https://github.com/zotyoka/u-filer)[ Packagist](https://packagist.org/packages/zotyo/u-filer)[ RSS](/packages/zotyo-u-filer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

uFiler
======

[](#ufiler)

The package offers you a more convenient way to manage file uploads in [Laravel](https://laravel.com).

Instead of reinventing the wheel at each file-upload managing your uploaded files will be easy and consistent.

- Upload file with unique name, without concurrency problems.
- Store client-side informations of uploaded files in FileDescriptors.
- File object for ease of managing files in your application.
- Helper trait for your Eloquent models to easily create accessors/mutators.
- User friendly replacement of regular &lt;input type="file"/&gt;

By default the package is configured to upload images but you can use for any mime type.

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

[](#installation)

```
composer require "zotyo/u-filer"

```

After downloading the package, add PackageServiceProvider to the providers array of your config/app.php

```
Zotyo\uFiler\PackageServiceProvider::class

```

Finally you should publish config of the package with some examples.

```
php artisan vendor:publish --provider="Zotyo\uFiler\PackageServiceProvider"

```

Usage
-----

[](#usage)

Several components come with the package to reduce the effort of implementing a proper file-upload.

File-input
----------

[](#file-input)

You can publish a **file-input.vue** component into your */resources/assets/js/components* folder. Modify the component so it would fit into your design.

```

    Avatar

```

The vue-component uploads the file to a specific endpoint.

Note: You can avoid [VueJS](https://vuejs.org) at all if you want so.

#### Endpoint(Route+Controller)

[](#endpointroutecontroller)

The package provides an Http endpoint for uploading files. You can disable the endpoint int the configuration file. If you would like to define your custom endpoint, you can still reuse **UploadControllerTrait**.

```
Method    | URI               | Name          | Action
POST      | upload            | upload        | Zotyo\uFiler\Http\UploadController@upload

```

### Eloquent

[](#eloquent)

The **HasFile** trait provides methods so you can easily create accessors/mutators in you model. In the following example User's avatar is a file.

```
