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

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

palmosolutions/laravel-elfinder
===============================

A Laravel Package to integrate elFinder 2

12.0(10mo ago)048MITPHPPHP ^8.1

Since Jan 24Pushed 10mo agoCompare

[ Source](https://github.com/Palmosolutions/laravel-elfinder)[ Packagist](https://packagist.org/packages/palmosolutions/laravel-elfinder)[ RSS](/packages/palmosolutions-laravel-elfinder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

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

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

### For Laravel 8.x and older, please use the latest 0.4 version.

[](#for-laravel-8x-and-older-please-use-the-latest-04-version)

[![Packagist License](https://camo.githubusercontent.com/c8e4db26372e7b8d2e384d0b9ff69f62ddfb02e075c6f7384028cbbc0a02cfec/68747470733a2f2f706f7365722e707567782e6f72672f62617272797664682f6c61726176656c2d656c66696e6465722f6c6963656e73652e706e67)](http://choosealicense.com/licenses/mit/)[![Latest Stable Version](https://camo.githubusercontent.com/01bfede68f4d1806663c377de552304e49e278921a5949df9f4a1095da614b0c/68747470733a2f2f706f7365722e707567782e6f72672f62617272797664682f6c61726176656c2d656c66696e6465722f76657273696f6e2e706e67)](https://packagist.org/packages/barryvdh/laravel-elfinder)[![Total Downloads](https://camo.githubusercontent.com/5a98b4c9e7e1fd2aa4bb34a1d5ae4cd1b77389ddfd4edaac627d38288e418a26/68747470733a2f2f706f7365722e707567782e6f72672f62617272797664682f6c61726176656c2d656c66696e6465722f642f746f74616c2e706e67)](https://packagist.org/packages/barryvdh/laravel-elfinder)

This packages integrates [elFinder](https://github.com/Studio-42/elFinder), 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/barryvdh/elfinder-builds)

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

[![image](https://user-images.githubusercontent.com/973269/158461690-2e6431a1-3a36-43f2-8219-0a21cee85ffc.png)](https://user-images.githubusercontent.com/973269/158461690-2e6431a1-3a36-43f2-8219-0a21cee85ffc.png)

### Installation

[](#installation)

Require this package with Composer

```
composer require barryvdh/laravel-elfinder

```

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='Barryvdh\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='Barryvdh\Elfinder\ElfinderServiceProvider' --tag=views

```

### Using Filesystem disks

[](#using-filesystem-disks)

Laravel 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. If you do not provide an URL, the URL will be generated by the disk itself.

### 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.

### TinyMCE 5.x

[](#tinymce-5x)

You can use tinyMCE 5 integration with the following route `/elfinder/tinymce5`:

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

In the TinyMCE init code, add the following line:

```
file_picker_callback : elFinderBrowser
```

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

```
function elFinderBrowser (callback, value, meta) {
    tinymce.activeEditor.windowManager.openUrl({
        title: 'File Manager',
        url: elfinder_url,
        /**
         * On message will be triggered by the child window
         *
         * @param dialogApi
         * @param details
         * @see https://www.tiny.cloud/docs/ui-components/urldialog/#configurationoptions
         */
        onMessage: function (dialogApi, details) {
            if (details.mceAction === 'fileSelected') {
                const file = details.data.file;

                // Make file info
                const info = file.name;

                // Provide file and text for the link dialog
                if (meta.filetype === 'file') {
                    callback(file.url, {text: info, title: info});
                }

                // Provide image and alt text for the image dialog
                if (meta.filetype === 'image') {
                    callback(file.url, {alt: info});
                }

                // Provide alternative source and posted for the media dialog
                if (meta.filetype === 'media') {
                    callback(file.url);
                }

                dialogApi.close();
            }
        }
    });
}
```

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