helios-ag / fm-elfinder-bundle
ElFinder bundle, adds ElFinder file manager to your Symfony project
Package info
github.com/helios-ag/FMElfinderBundle
Type:symfony-bundle
pkg:composer/helios-ag/fm-elfinder-bundle
Requires
- php: ^8.1
- ext-json: *
- studio-42/elfinder: ~2.1.62
- symfony/asset: ^6.4 || ^7.0 || ^8.0
- symfony/console: ^6.4 || ^7.0 || ^8.0
- symfony/form: ^6.4 || ^7.0 || ^8.0
- symfony/framework-bundle: ^6.4 || ^7.0 || ^8.0
- symfony/twig-bundle: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: dev-master
- league/flysystem: ^3.0
- league/flysystem-ftp: ^3.0
- league/flysystem-sftp-v3: ^3.0
- matthiasnoback/symfony-config-test: ^6.0
- matthiasnoback/symfony-dependency-injection-test: ^6.0
- php-coveralls/php-coveralls: ^2.0
- spatie/dropbox-api: ^1.0|^2.0
- spatie/flysystem-dropbox: ^3.0
- symfony/finder: ^6.4 || ^7.0 || ^8.0
- symfony/phpunit-bridge: ^6.4 || ^7.0.1 || ^8.0
Suggests
- barryvdh/elfinder-flysystem-driver: Flysystem v3 compatible elFinder volume driver (requires ^0.5, older versions target Flysystem 1.x)
- friendsofsymfony/ckeditor-bundle: FOSCKEditorBundle WYSIWYG Editor Bundle
- helios-ag/fm-summernote-bundle: FMSummernoteBundle WYSIWYG Editor Bundle
- helios-ag/fm-tinymce-bundle: FMTinyMCEBundle WYSIWYG Editor Bundle
- spatie/flysystem-dropbox: Dropbox 2 Driver for Flysystem
Provides
None
Conflicts
None
Replaces
None
- dev-main / 14.x-dev
- 14.0
- 13.0.3
- 13.0.2
- 13.0.1
- 13
- 12.7.3
- 12.7.2
- 12.7.1
- 12.7
- 12.6
- 12.5
- 12.4
- 12.3.3
- 12.3.2
- 12.3.1
- 12.3
- 12.2.3
- 12.2.2
- 12.2.1
- 12.2
- 12.1.3
- 12.1.2
- 12.1.1
- 12.1
- 11.0
- 10.1
- 10.0.4
- 10.0.3
- 10.0.2
- 10.0.1
- 10
- 9.3.2
- 9.3.1
- 9.3
- 9.2.1
- 9.2
- 9.1.1
- 9.1
- 9
- 8.0.3
- 8.0.2
- 8.0.1
- 8.0
- 7.0.1
- 7.0
- 6.2.1
- 6.2
- 6.1.2
- 6.1.1
- 6.1
- 6.0.3
- 6.0.2
- 6.0.1
- 6.0
- 5.3
- 5.2.1
- 5.2
- 5.1
- 5.0.5
- 5.0.4
- 5.0.3
- 5.0.2
- 5.0.1
- 5
- 4.0.2
- 4.0.1
- 4.0
- 3.4
- 3.3
- 3.2.1
- 3.2
- 3.1
- 3.0
- 2.5.1
- 2.5
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.1
- v2.0
- 1.5
- 1.4.2
- 1.4.1
- 1.4
- 1.3
- 1.2
- 1.1
- 1.0
- dev-codex/security-audit-hardening
This package is auto-updated.
Last update: 2026-11-22 03:40:12 UTC
README
ElFinder integration in Symfony
Code Quality Assurance
| Tests | Coverage | License | Version |
|---|---|---|---|
| Downloads |
|---|
elFinder is an open-source file manager for web, written in JavaScript using jQuery UI. Creation is inspired by simplicity and convenience of Finder program used in Mac OS X operating system.
Recommended bundles to use with:
| FMTinyMCEBundle | FOSCKEditorBundle | FMSummernoteBundle |
|---|---|---|
Table of contents
- Installation
- Basic configuration
- CORS support
- Events listeners / subscribers
- Elfinder Form Type
- CKEditor integration
- TinyMCE integration
- Summernote integration
- Advanced configuration
- Configuration dump
Installation
Step 1: Installation
For Symfony Flex installation you need to enable community recipes:
composer config extra.symfony.allow-contrib true
Install the bundle:
composer require helios-ag/fm-elfinder-bundle
Prepare the elFinder assets inside the bundle, then publish them with Symfony:
bin/console elfinder:install bin/console assets:install public
The bundle requires elFinder 2.1.70 or newer within the 2.1 series. After upgrading, rerun both commands to publish the client that supports CSRF tokens.
The order is important: elfinder:install assembles the bundle's upstream and
integration assets, then assets:install copies or symlinks them into
public/bundles/fmelfinder. Pass a different target directory or --symlink to
Symfony's assets:install command when needed.
For Composer auto-scripts, keep the same order in the application composer.json:
{
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"elfinder:install": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
}
}
Create the local upload directory used by the basic configuration below:
mkdir -p public/uploads
Make sure the PHP and web-server users have the required read and write
permissions for public/uploads.
Step 2: Enable the bundle (Optional)
Enable the bundle in the kernel (not needed with symfony flex):
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new FM\ElfinderBundle\FMElfinderBundle(), ); }
Step 3: Import FMElfinderBundle routing file
# app/config/routing.yaml elfinder: resource: "@FMElfinderBundle/Resources/config/routing.yaml"
The default file-manager instance is now available at /elfinder; its connector
endpoint is /efconnect.
Step 4: Configure your application's security.yaml
Secure ElFinder with access_control:
# app/config/security.yaml security: # ... access_control: - { path: ^/efconnect, roles: ROLE_USER } - { path: ^/efupload, roles: ROLE_USER } - { path: ^/elfinder, roles: ROLE_USER }
Connector and upload security
- elFinder connector. Commands that modify files or cancel operations require
POST and a valid
X-elFinder-CSRFheader. The bundled client handles this automatically. Custom clients should read thecsrfvalue returned bycmd=openwithinit=1and send it in the header. If the connector returns HTTP 403 withcsrfReload: true, initialize it again to obtain a valid token. Cancellation is scoped to the session that started the operation. - CKEditor uploads. The
/efuploadendpoint requiresX-Requested-With: XMLHttpRequest. The bundled adapter adds it automatically. Set it explicitly when using CKEditor 5 Simple Upload Adapter or a custom client. See the CKEditor integration guide. - Cross-origin requests. Allow only trusted editor origins and the headers your client uses. See the CORS configuration guide.
By default, uploads accept common raster image formats up to 20 MiB per file.
Configure upload_allow and upload_max_size on each root to override these
defaults. PHP and web server request limits also apply. Only allow SVG when the
application controls how uploaded SVGs are served.
The connector does not fetch files from remote URLs. Upload the file contents directly. Thumbnail creation and resizing require the volume to report image dimensions and are limited to 24,000,000 pixels per input image. Resize requests have the same limit on the requested output dimensions.
Basic configuration
Add configuration options to your config.yaml
fm_elfinder: # Matches public/bundles/fmelfinder published by assets:install. assets_path: / instances: default: locale: '%locale%' # defaults to current request locale editor: ckeditor # other options are tinymce, tinymce4, tinymce5, fm_tinymce, form, simple, custom relative_path: false #default true, will produce absolute urls to specified file(s) #editor_template: custom template for your editor # default null #path_prefix: / # for setting custom assets path prefix, useful for non vhost configurations, i.e. http://127.0.0.1/mysite/ #fullscreen: true|false # default is true, applies to simple and ckeditor editors #theme: smoothness # jquery theme, default is 'smoothness' #visible_mime_types: ['image/png', 'image/jpg', 'image/jpeg'] # only show these mime types, defaults to show all connector: #debug: true|false # defaults to false roots: # at least one root must be defined, defines root filemanager directories uploads: #show_hidden: true|false # defaults to false, hides dotfiles driver: LocalFileSystem path: '%kernel.project_dir%/public/uploads' url: /uploads upload_allow: ['image/png', 'image/jpg', 'image/jpeg'] upload_deny: ['all'] upload_max_size: 2M # also file upload sizes restricted in php.ini #attributes: example of setting attributes permission # - { pattern: '/(.*?)/', read: true, write: false, locked: true }
- default - instance of elfinder, can be used to define multiple configurations of ElFinder, allows simultaneous configuration for different types of WYSIWYG editors in your project
- assets_path - public URL prefix for the installed elFinder assets. The
/value matches the defaultpublic/bundles/fmelfinderdestination created by Symfony'sassets:install. - path - filesystem path to the root directory. For a local public upload directory, use
%kernel.project_dir%/public/uploadsand make sure it has the required read/write and owner permissions. - url - public URL prefix used when displaying files. For the local root above this is
/uploads. It can also be an absolute URL and may contain a{homeFolder}placeholder. Set it explicitly whenpathis an absolute filesystem path and the integration requires a public URL (for example, CKEditor uploads). With a relativepath, the bundle can still derive the URL when this option is omitted. - driver - can be LocalFileSystem, FTP or MySQL, Flysystem, S3 and etc, check class FM\ElfinderBundle\DependencyInjection\Configuration
- locale - locale determines, which language, ElFinder will use, to translate user interface, default is current request locale
- cors_support - allows cross domain responses handling (default false)
- editor - determines what template to render, to be compatible with WYSIWYG web editor, currently supported options are: "ckeditor" (to use with FOSCKEditorBundle or TrsteelCkeditorBundle), "tinymce5" for TinyMCE 5–8, "fm_tinymce" for tinymce4 (to use with FMTinyMCEBundle), "form" for form type, "simple" for standalone and "custom" for custom template. See the TinyMCE integration guide for version-specific setup.
- editor_template - define template to render when editor is set to "custom".
- connector - root node for defining options for elfinder root directories.
- roots - define "virtual directories" that reflect directories in your project.
- path_prefix - path prefix with relative_path enabled, default is slash ('/')
- show_hidden - show files and folders that starts from . (dot)
- driver - driver type, LocalFileSystem, Dropbox, FTP
- volume_id - (optional) can be used to force a volume id when mounting volume (default auto-increments). If provided, it must be an integer bigger than 0.
- alias - directory alias
- path - directory that contains files
- upload_allow: ['image/png', 'image/jpg', 'image/jpeg']
- upload_deny: ['all']
- upload_max_size: 2M
You can see the full list of roots options here. To use them, convert camelCased option name to snake_case name.
Use multiple upload folder by instance
You can set multiple upload root folder by instance configuration.
If you have configured your instance with /uploads path, you can provide
an additional folder as a home folder (e.g. for a multi-users application) when accessing to the instance URL :
/elfinder/{instance}/{homeFolder} or /efconnect/{instance}/{homeFolder}
For example, accessing to /elfinder/acmeInstance/bob URL will open up elfinder with
/uploads/bob as root directory which only contains Bob's files.
Then, accessing to /elfinder/acmeInstance/alice URL will re-use your instance,
but open up elfinder with /uploads/alice folder as root directory, containing only Alice's files.
Home folders can also be nested. For example,
/elfinder/acmeInstance/body/articles/criteres_memes uses
/uploads/body/articles/criteres_memes as the root directory.
The home folder must be a relative path made of non-empty segments separated by a
single forward slash (/). Unicode characters, spaces, and dots inside segment
names are accepted, but empty segments, . and .. segments, backslashes,
leading or trailing slashes, and NUL bytes are rejected.
To use this feature, you must provide the instance name in the URL, and of course be sure to set proper write/read permissions on home folders.
Note: this feature is only available with LocalFileSystem driver.
If I want more one home folder is possible ?
Yes you can with this configuration in your fm_elfinder.yaml
where_is_multi: {connector}: {index of the connector} multi_home_folder: true folder_separator: {one char other of /}
Example
fm_elfinder:
instances:
default:
locale: fr # defaults to current request locale
editor: ckeditor # other options are tinymce, tinymce4, tinymce5, fm_tinymce, form, simple, custom
#editor_template: custom template for your editor # default null
#path_prefix: http://localhost/ # for setting custom assets path prefix, useful for non vhost configurations, i.e. http://127.0.0.1/mysite/
fullscreen: false # default is true, applies to simple and ckeditor editors
where_is_multi:
roots: 0
multi_home_folder: true
folder_separator: "|"
#theme: smoothness # jquery theme, default is 'smoothness'
#visible_mime_types: ['image/png', 'image/jpg', 'image/jpeg'] # only show these mime types, defaults to show all
connector:
#debug: true|false # defaults to false
roots: # at least one root must be defined, defines root filemanager directories
uploads:
#show_hidden: true|false # defaults to false, hides dotfiles
driver: LocalFileSystem
path: "/var"
alias: Bibliothèque générale
upload_allow: ['all']
#upload_deny: ['all']
upload_max_size: 500M # also file upload sizes restricted in php.ini
attributes:
- {pattern: '..', read: true, write: true, locked: false}
#attributes: example of setting attributes permission
# - { pattern: '/(.*?)/', read: true, write: false, locked: true }