Download the PHP package solbeg/laravel-files-manager without Composer
On this page you can find all versions of the php package solbeg/laravel-files-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download solbeg/laravel-files-manager
More information about solbeg/laravel-files-manager
Files in solbeg/laravel-files-manager
Package laravel-files-manager
Short Description Extended files logic for Laravel applications. Simple file uploading. Using files in models similar to other any simple attribute.
License
Informations about the package laravel-files-manager
Description
Files manager for laravel 5.2/5.3. It is helpful to simply upload and use in future files, and work with them like with another simple attributes.
It flexible so you may customize your validation, formatted versions of files (e.g. thumbnails), default urls, storages as you want. You may separate your files by contexts, and contexts by types. Also you may configure global setting that will be used for all contexts.
This plugin also allows to save file in temporary directory between requests. So if validation of request's data was failed user must not upload a file again.
Solbeg/laravel-files-manager uses standard laravel's filesystem to storing files, so you may use it with any storage driver like local, amazon S3, rackspace or others.
For manipulating with images this package uses Intervention/image plugin.
Requirements
- PHP >= 5.5.9
- Fileinfo Extension
- Laravel Framework 5.2. or 5.3.
- Intervention/image plugin (only for working with images)
Installation
The best way to install this plugin is using Composer.
To install the most recent version, run the following command:
After you have installed this vendor, add the following lines.
In your Laravel config file config/app.php
in the $providers
array
add the service provider for this package.
In your application Kernel.php
class in the web
middleware group
add middleware for this package.
If you will use standard laravel's public path,
then you need to create symbolic link from public/storage
to storage/app/public
directory.
You may read about this here.
If you are not create it yet, you may do it quickly through artisan command:
Installation of intervention/image
If you want to work with images, you likely want to install intervention/image
plugin.
Because all formatters of this files manager that work with images require it.
For installing intervention/image
plugin follow the next instructions
or read official documentation (Composer Installation and Integration in Laravel):
here.
Install it via composer:
After you have installed Intervention Image, open your Laravel config file config/app.php
and add the following lines.
In the $providers
array add the service providers for this package.
Add the facade of this package to the $aliases
array.
Configure
At first we suggest publish config/filemanager.php
config file,
so you may quickly configure the plugin as you want.
You may do it with artisan console command.
All files in this plugin are separated by contexts. For example: you probably want to have 'product-logo' and 'user-avatar' contexts, so each of them have own custom config (validation, formatters and others).
So you likely want to create your the first context. You may do it in two ways: add config in your config folder or define it inline in your model. We recommend the first way because it keeps your models cleaner.
For quickly creating context you may use artisan console command:
Where context-name
you should replace with your name of a new context, e.g. product-logo
.
Then see file config/filecontexts/{context-name}.php
for more info about available settings.
Configure model
You likely want to work with files, names of which stored in database. So you should configure your Eloquent model.
For it you need include Solbeg\FilesManager\ModelFilesTrait
in you Eloquent model
and add filesAttributes()
method.
Example:
Usage
In your controller:
In your blade template:
In JSON action:
You may read more about exporting files to array and json here; Read also how to configure which properties of file must be exported.
Requests validation
When you validate your requests using laravel's validation system, you not need write validation rules again.
Simply use filecontext
validator, and file will be validates by context validation rules:
If file is valid, but any other attributes was failed,
the uploaded file will be saved in temporary storage.
So you may use old($fileAttribute)
in your form:
Features under development
Documentation
Read more about:
- Contexts
- Formatting
- Validation
- File Not Found Handlers
- Storages
- Name Generators
- Using in REST Api
- Garbage Collector
All versions of laravel-files-manager with dependencies
illuminate/container Version 5.2.*|5.3.*
illuminate/contracts Version 5.2.*|5.3.*
illuminate/console Version 5.2.*|5.3.*
illuminate/database Version 5.2.*|5.3.*
illuminate/events Version 5.2.*|5.3.*
illuminate/filesystem Version 5.2.*|5.3.*
illuminate/http Version 5.2.*|5.3.*
illuminate/session Version 5.2.*|5.3.*
illuminate/support Version 5.2.*|5.3.*
illuminate/validation Version 5.2.*|5.3.*
paragonie/random_compat Version >=1.0
symfony/http-foundation Version 2.8.*|3.0.*|3.1.*