PHPackages                             skylinegtrs/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. skylinegtrs/laravel-elfinder

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

skylinegtrs/laravel-elfinder
============================

A Laravel Package to integrate elFinder 2

23PHP

Since Feb 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/SkylineGTRS/Laravel-Elfinder-Remastered)[ Packagist](https://packagist.org/packages/skylinegtrs/laravel-elfinder)[ RSS](/packages/skylinegtrs-laravel-elfinder/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

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

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

[![License](https://camo.githubusercontent.com/034cb7863d13de360087eb3344fcf6fcf32848e779ddaab91eb866722380ffd2/68747470733a2f2f706f7365722e707567782e6f72672f736b796c696e65677472732f6c61726176656c2d656c66696e6465722f6c6963656e7365)](http://choosealicense.com/licenses/mit/)[![Latest Stable Version](https://camo.githubusercontent.com/5f0a3538575727cecc653174cafd8b57bc5456f4ba2a28d4424122888c0a5b92/68747470733a2f2f706f7365722e707567782e6f72672f736b796c696e65677472732f6c61726176656c2d656c66696e6465722f762f737461626c65)](https://packagist.org/packages/skylinegtrs/laravel-elfinder)[![Total Downloads](https://camo.githubusercontent.com/5ab0a5268fcfd0025acde19411c1951404b5f52a9819a476761cb37be9db6f9d/68747470733a2f2f706f7365722e707567782e6f72672f736b796c696e65677472732f6c61726176656c2d656c66696e6465722f646f776e6c6f616473)](https://packagist.org/packages/skylinegtrs/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.

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

### Installation

[](#installation)

Require this package with Composer

```
composer require skylinegtrs/laravel-elfinder

```

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

```
SkylineGTRS\Elfinder\ElfinderServiceProvider::class
```

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='SkylineGTRS\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='SkylineGTRS\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/barryvdh/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', '.+');
    ```
3. Add the disk to your elfinder config:

    ```
    'disks' => [
        'public' => [
            'glideURL' => '/glide',
        ],
    ],
    ```
4. (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.

### Restricting file uploads(to instert it into view) by its file type and amount(max\_files) designed specialy for standalone popup.

[](#restricting-file-uploadsto-instert-it-into-view-by-its-file-type-and-amountmax_files-designed-specialy-for-standalone-popup)

For example we have several sections like news, products, blog for which different file types are allowed and and amount of pixtures we would like to to instert, for news 3, for products only one and for blogs 10.

By default we are passing these 3 parameters, which are mandatory:

```

```

```
inputid			- id of the inserted item
max_files		- allowed maximum files for the sertein section
route_name		- the name of the route(define name by yourself)

```

Please publish the views to be able to edit the default markup for according to your needs.

### 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: '
