PHPackages                             ribrit/laravel-elfinder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. ribrit/laravel-elfinder

ActiveLibrary[File &amp; Storage](/categories/file-storage)

ribrit/laravel-elfinder
=======================

A Laravel Package to integrate elFinder 2

1.0.0(9y ago)025MITPHPPHP &gt;=5.6.0

Since Jun 3Pushed 9y agoCompare

[ Source](https://github.com/ribrit/laravel-elfinder)[ Packagist](https://packagist.org/packages/ribrit/laravel-elfinder)[ RSS](/packages/ribrit-laravel-elfinder/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (2)Used By (0)

elFinder Package for Laravel 5
------------------------------

[](#elfinder-package-for-laravel-5)

### For Laravel 4, please use the [0.2 branch](https://github.com/ribrit/laravel-elfinder/tree/0.2)!

[](#for-laravel-4-please-use-the-02-branch)

[![Packagist License](https://camo.githubusercontent.com/a965a517883d895d505c04fac7bde3a4b7139c4887b9223014ef1517bc76d0ed/68747470733a2f2f706f7365722e707567782e6f72672f7269627269742f6c61726176656c2d656c66696e6465722f6c6963656e73652e706e67)](http://choosealicense.com/licenses/mit/)[![Latest Stable Version](https://camo.githubusercontent.com/a9137324bd7ced5c8ea6ffd408b5f8ebbcac02aa9f3fb8403b43e23d4a3cf822/68747470733a2f2f706f7365722e707567782e6f72672f7269627269742f6c61726176656c2d656c66696e6465722f76657273696f6e2e706e67)](https://packagist.org/packages/ribrit/laravel-elfinder)[![Total Downloads](https://camo.githubusercontent.com/6cb4fcd80cfb9431b63a778d9e3180eeee21638f0b6d86a1362608290f6334c4/68747470733a2f2f706f7365722e707567782e6f72672f7269627269742f6c61726176656c2d656c66696e6465722f642f746f74616c2e706e67)](https://packagist.org/packages/ribrit/laravel-elfinder)

This packages integrates [elFinder 2.1](https://github.com/Studio-42/elFinder/tree/2.1), by making the php files available with Composer (+autoloading) and the assets with a publish command. It also provides some example views for standalone, tinymce and ckeditor. Files are updated from the a seperate [build repository](https://github.com/ribrit/elfinder-builds)

> Note: Use `php artisan elfinder:publish` instead of the old publish command, for future changes!

### Installation

[](#installation)

Require this package with Composer

```
composer require ribrit/laravel-elfinder

```

Add the ServiceProvider to the providers array in app/config/app.php

```
'Ribrit\Elfinder\ElfinderServiceProvider'

```

You need to copy the assets to the public folder, using the following artisan command:

```
php artisan elfinder:publish

```

Remember to publish the assets after each update (or add the command to your post-update-cmd in composer.json)

Routes are added in the ElfinderServiceProvider. You can set the group parameters for the routes in the configuration. You can change the prefix or filter/middleware for the routes. If you want full customisation, you can extend the ServiceProvider and override the `map()` function.

### Configuration

[](#configuration)

The default configuration requires a directory called 'files' in the public folder. You can change this by publishing the config file.

```
php artisan vendor:publish --provider='Ribrit\Elfinder\ElfinderServiceProvider' --tag=config

```

In your config/elfinder.php, you can change the default folder, the access callback or define your own roots.

### Views

[](#views)

You can override the default views by copying the resources/views folder. You can also do that with the `vendor:publish` command:

```
php artisan vendor:publish --provider='Ribrit\Elfinder\ElfinderServiceProvider' --tag=views

```

### Using Filesystem disks

[](#using-filesystem-disks)

Laravel 5 has the ability to use Flysystem adapters as local/cloud disks. You can add those disks to elFinder, using the `disks` config.

This examples adds the `local` disk and `my-disk`:

```
'disks' => [
    'local',
    'my-disk' => [
        'URL' => url('to/disk'),
        'alias' => 'Local storage',
    ]
],

```

You can add an array to provide extra options, like the URL, alias etc. [Look here](https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options-2.1#root-options) for all options.

### Using Glide for images

[](#using-glide-for-images)

See [elfinder-flysystem-driver](https://github.com/ribrit/elfinder-flysystem-driver) for [Glide](http://glide.thephpleague.com/) usage. A basic example with a custom Laravel disk and Glide would be:

1. Add the disk to your apps config/filesystems disks:

```
'public' => [
    'driver' => 'local',
    'root'   => base_path().'/public',
],

```

> Tip: you can use the `extend` method to register your own driver, if you want to use non-default Flysystem disks

2. Create a Glide Server for your disk, eg. on the `glide/` route, using a cache path:

```
	Route::get('glide/{path}', function($path){
		$server = \League\Glide\ServerFactory::create([
		    'source' => app('filesystem')->disk('public')->getDriver(),
		    'cache' => storage_path('glide'),
		]);
		return $server->getImageResponse($path, Input::query());
	})->where('path', '.+');

```

4. Add the disk to your elfinder config:

```
	'disks' => [
	    'public' => [
	        'glideURL' => '/glide',
	    ]
	],

```

5. (Optional) Add the `glideKey` also to the config, and verify the key in your glide route using the Glide HttpSignature.

You should now see a root 'public' in elFinder with the files in your public folder, with thumbnails generated by Glide. URLs will also point to the Glide server, for images.

### TinyMCE 4.x

[](#tinymce-4x)

You can use tinyMCE integration with the following route, which by default is `/elfinder/tinymce4`:

```
route('elfinder.tinymce4');

```

In the TinyMCE init code, add the following line:

```
file_browser_callback : elFinderBrowser
```

Then add the following function (change the `elfinder_url` to the correct path on your system):

```
function elFinderBrowser (field_name, url, type, win) {
  tinymce.activeEditor.windowManager.open({
    file: '
