I'll demonstrate how to install the file manager package in a Laravel application in this blog. This package supports the integration of cloud storage and the selection of various files.
This File Manager is simple to setup, and the forthcoming version will have cloud support.
Features :-
- Integration of CKEditor, TinyMCE, and Summernote
- Independent button
- submitting proof
- Image scaling and cropping
- Multi-user public and private folders
- Customizable folder path, middlewares, routes, and views
- Offers support for files and images. Every kind operates in a unique directory.
- The following localities are supported: ar, bg, de, el, en, es, fa, fr, it, he, hu, nl, pl, pt-BR, pt PT, ro, ru, sv, tr, zh-CN, and zh-TW
I'll provide a complete example of how to incorporate a file management package here. Let's proceed by following the steps below.
Install Laravel App
You can install the fresh Laravel app in this stage. Open a terminal and type the command below.
composer create-project --prefer-dist laravel/laravel blog
Install Unisharp File Manager Package
Installing the file manager package in this Laravel application step. Open a terminal and type the command below.
composer require unisharp/laravel-filemanager
Add Provider and Aliase
You can add providers and aliases in the configuration app file in this phase, so let's open the app.php file and do that.
config/app.php
//Providers UniSharp\LaravelFilemanager\LaravelFilemanagerServiceProvider::class, Intervention\Image\ImageServiceProvider::class, //Aliases 'Image' => Intervention\Image\Facades\Image::class,
Publish Config File
Using the command below, you can publish the package's configuration and assets in this phase.
php artisan vendor:publish --tag=lfm_config php artisan vendor:publish --tag=lfm_public
Create symbolic link
Using the command below, you can build a symbolic link in this phase.
php artisan storage:link
Edit .env File
We must alter the .env file in this step to replace APP URL with your localhost URL.
.env
http://localhost:8000
Add Route
Currently, we must build a route to the Laravel application that provides access to the File Manager package. so add the following route by opening your "routes/web.php" file.
routes/web.php
Route::group(['prefix' => 'laravel-filemanager', 'middleware' => ['web', 'auth']], function (){ \UniSharp\LaravelFilemanager\Lfm::routes(); });
Now that our example is ready to run, use the command below for a quick run:
php artisan serve
You may now open the URL below in your browser after first logging in.
http://localhost:8000/laravel-filemanager