Laravel File Manager Tutorial Example

10-Apr-2023

.

Admin

Laravel File Manager Tutorial Example

Hi Dev,

In this blog, I will show you how to install file manager package in laravel application. This package support multiple files selection, cloud storage integration.

This File Manager is easy to install and they are bringing cloud support to their upcoming release.

Features :-


1. CKEditor, TinyMCE and Summernote integration

2. Standalone button

3. Uploading validation

4. Cropping and resizing of images

5. Public and private folders for multi users

6. Customizable routes, middlewares, views, and folder path

7. Supports two types : files and images. Each type works in different directory.

8. Supported locales : ar, bg, de, el, en, es, fa, fr, it, he, hu, nl, pl, pt-BR, pt_PT, ro, ru, sv, tr, zh-CN, zh-TW

Here I will give full example for integrate file manager package. So Let's follow the bellow step by step.

Step 1 : Install Laravel App

In this step, You can install laravel fresh app. So open terminal and put the bellow command.

composer create-project --prefer-dist laravel/laravel blog

Step 2 : Install Unisharp File Manager Package

In this step, You can install file manager package in this laravel app. So open terminal and put the bellow command.

composer require unisharp/laravel-filemanager

Step 3 : Add Provider and Aliase

In this step, You can add providers and aliases in config app file So lets open app.php file and add provider and aliases.

config/app.php

//Providers

UniSharp\LaravelFilemanager\LaravelFilemanagerServiceProvider::class,

Intervention\Image\ImageServiceProvider::class,

//Aliases

'Image' => Intervention\Image\Facades\Image::class,

Step 4 : Publish Config File

In this step, You can publish the package’s config and assets using bellow command.

php artisan vendor:publish --tag=lfm_config

php artisan vendor:publish --tag=lfm_public

Step 5 : Create symbolic link

In this step, You can create symbolic link using bellow command.

php artisan storage:link

Step 6 : Edit .env File

In this step, We have to edit .env file in change APP_URL your localhost url.

.env

APP_URL=http://localhost:8000

Step 7 : Add Route

now, we need to add route for File manager package provide route in laravel application. so open your "routes/web.php" file and add following route.

routes/web.php

Route::group(['prefix' => 'laravel-filemanager', 'middleware' => ['web', 'auth']], function (){

\UniSharp\LaravelFilemanager\Lfm::routes();

});

Now we are ready to run our example so run bellow command for quick run:

php artisan serve

Now you can first login thenafter open bellow URL on your browser

http://localhost:8000/laravel-filemanager

It will help you...

#Laravel 7

#Laravel

#Laravel 6