Download the PHP package zotyo/u-filer without Composer
On this page you can find all versions of the php package zotyo/u-filer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zotyo/u-filer
More information about zotyo/u-filer
Files in zotyo/u-filer
Informations about the package u-filer
uFiler
The package offers you a more convenient way to manage file uploads in Laravel.
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 <input type="file"/>
By default the package is configured to upload images but you can use for any mime type.
Installation
After downloading the package, add PackageServiceProvider to the providers array of your config/app.php
Finally you should publish config of the package with some examples.
Usage
Several components come with the package to reduce the effort of implementing a proper file-upload.
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.
The vue-component uploads the file to a specific endpoint.
Note: You can avoid VueJS at all if you want so.
Endpoint(Route+Controller)
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.
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.
Validation
Don't forget to validate files when submitting your entities. The package provides the verify-file-by-token validation rule to avoid hijacking of files.