Handling files is one of a usual routine in most web-projects, but it’s not so easy to build from scratch: file extensions, upload, thumbnails, security etc. So on top of Laravel Filesystem there are a few useful packages to help you.

1. UniSharp/laravel-filemanager
Released: October 2015
Installs: 54 000
Last update: May 2017 (6 days ago)

This package adds a convenient file manager on top of TinyMCE or CKEditor.

It’s quite easy to install – you just need to configure some things and put the URL in your JavaScript. Here’s how it looks for CKEditor:

<textarea id="my-editor" name="content" class="form-control">{!! old('content', 'test editor content') !!}</textarea>
<script src="//cdn.ckeditor.com/4.6.2/standard/ckeditor.js"></script>
<script>
  var options = {
    filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images',
    filebrowserImageUploadUrl: '/laravel-filemanager/upload?type=Images&_token=',
    filebrowserBrowseUrl: '/laravel-filemanager?type=Files',
    filebrowserUploadUrl: '/laravel-filemanager/upload?type=Files&_token='
  };
</script>

We actually use this package in our QuickAdminPanel generator, for Textarea fields with CKEditor, so I highly recommend it.


2. barryvdh/laravel-elfinder
Released: January 2014
Installs: 191 000
Last update: Jan 2017 (4 months ago)

This package is actually a Laravel-tailored wrapper for elFinder – open-source file manager for web, written in JavaScript using jQuery and jQuery UI.

It uses Laravel’s Filesystem, and also can be integrated into TinyMCE and CKEditor.


3. spatie/laravel-medialibrary
Released: August 2015
Installs: 178 000
Last update: May 2017 (1 day ago)

This one is a little different. It’s not a visual file manager, but it gives a set of functions to easily handle media/files in your Laravel app.

Their tagline is “Associate files with Eloquent models”, which doesn’t say much, but in reality it’s a powerful time-saver package. Here are some examples, you will understand everything then:

// Attach media file to any item
$newsItem = News::find(1);
$newsItem->addMedia($pathToFile)->toMediaCollection('images');

// Associate uploaded file with any collection
$newsItem->addMedia($request->file('image'))->toMediaCollection('images');

// Yes, and it works with thumbnails, too!
$newsItem->getMedia('images')->first()->getUrl('thumb');

Also it has an awesome clear documentation page.

So these packages are my personal Top 3. Anything to add to that list?