redkite-labs/redkite-labs-elfinder-bundle
RedKite Labs elFinder Bundle integrates the elFinder file manager into Symfony applications, providing a configurable file browser UI, file operations, connector setup, and asset integration for managing local or remote storage from admin panels.
Know what you're installing first. This is a Symfony2-era bundle (a fork of helios-ag/FMElfinderBundle) that wires the Studio-42 elFinder PHP connector into a Symfony app. It is not a Laravel package — there is no service provider, no facade, no config/ publish tag. If your app is Laravel, treat this as reference material for the elFinder connector and budget a port rather than an install. Everything below assumes Symfony 2.x/3.x-era wiring, which is where the package actually runs.
Minimal steps:
composer require redkite-labs/redkite-labs-elfinder-bundle
// app/AppKernel.php
$bundles = [ /* ... */ new RedKiteLabs\ElFinderBundle\ElFinderBundle() ];
# app/config/routing.yml
elfinder:
resource: "@ElFinderBundle/Resources/config/routing.yml"
prefix: /elfinder
# app/config/config.yml — verify the extension alias in DependencyInjection/*Extension.php first;
# forks ship under both `fm_elfinder` and vendor-prefixed keys
fm_elfinder:
instances:
default:
locale: %locale%
connector:
roots:
uploads:
path: %kernel.root_dir%/../web/uploads
url: /uploads
Then publish assets (php app/console assets:install web --symlink) and hit /elfinder. If you see the two-pane file manager with your uploads directory, you're done.
Where to look first, in this order:
DependencyInjection/Configuration.php — the real config tree. Docs (if any) are usually stale relative to this file; it is ground truth for root options, uploadAllow, uploadDeny, attributes, etc.Controller/ElFinderController.php — the show and connect actions, and what the connector route name actually is (ef_connect / elfinder in the upstream bundle).Resources/config/routing.yml — route names, because every integration you write will reference them.elfinder_init(), elfinder_instance('default')) in the bundle's Twig extension.First use case: an admin-only file manager for a web/uploads directory — browse, upload, rename, and delete assets that marketing pastes into CMS content.
Standalone admin page. Simplest integration: your own controller renders a template containing {{ elfinder_init() }}, and you protect the route with a firewall. Keep the view route and the connector route under the same security context — they are two separate routes and both need auth.
Picker embedded in a form. The pattern that actually earns its keep. Render elFinder in a hidden modal and use its getFileCallback to write the selected path into a hidden input, then show a thumbnail preview:
$('#elfinder-modal').dialog({ autoOpen: false, width: 900, height: 600, modal: true });
var fm = $('#elfinder').elfinder({
url: '/elfinder/connector', // the connect route, not the show route
getFileCallback: function (file) {
$('#image_path').val(file.url);
$('#elfinder-modal').dialog('close');
}
}).elfinder('instance');
This is where you get day-to-day value: one bundle serving images for product records, banners, and WYSIWYG content alike.
Multiple instances instead of multiple bundles. Define one instance per domain of files — media, documents, private — each with its own root, its own uploadAllow MIME list, and its own URL prefix. Select with elfinder_instance('media'). This is cleaner than one root with deep folders and gives you per-instance ACLs.
Per-user roots. Build roots config dynamically — a container-aware config extension or a small compiler pass that injects the current tenant/user ID into the root path, e.g. %kernel.root_dir%/../web/uploads/%tenant_id%. Keep the url in lockstep with the path, or files will list but refuse to preview.
CKEditor / TinyMCE integration. The bundle ships helper(s) that swap the editor's file browser button to elFinder. Use them rather than hand-rolling, because the editor callback contract (callback, fileBrowserCallback) differs between CKEditor 3/4 and the elFinder version bundled here.
Extension points when the bundle gets in the way. Override the controller via bundle inheritance (getParent()), or better, declare your own route pointing at your own controller that subclasses the bundle's. Custom volume drivers go in the connector options array; anything beyond that means forking — at which point evaluate the upstream helios-ag/FMElfinderBundle instead.
For Laravel teams: don't try to bend this into a service provider. Either (a) run elFinder's standalone PHP connector behind a Laravel route you control, or (b) use a native Laravel file-manager package. Porting this bundle is a day of work with no upstream to send fixes to.
%kernel.root_dir%, app/console, AppKernel) throughout. On any modern Symfony or Laravel app you are porting, not installing. Pin nothing and expect nothing back — 1 star, 0 dependents, no maintenance.<!DOCTYPE html>, it's auth, not elFinder. Exclude the connect route appropriately or ensure session auth is shared.path and url divergence. The most common "it works but thumbnails are broken" cause. path is server filesystem, url is the public prefix. They must describe the same directory.assets:install --symlink). In prod, re-run after deploy; symlinked assets + open_basedir restrictions break silently.var/logs/ and PHP error log together.alias.uploadAllow/uploadDeny MIME lists and attributes (hide/read/write locks) explicitly. Never point a root above the web root without an ACL — elFinder happily serves anything the PHP process can read.fm_elfinder instances, clear the Symfony cache (--env=prod too). Half of "my config change did nothing" reports are stale container caches.locale, editor, connector.roots[].path vs URL (capitalized in upstream) — read Configuration.php in this checkout rather than copying a blog post from the upstream bundle.How can I help you explore Laravel packages today?