Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Redkite Labs Elfinder Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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:

  1. 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.
  2. Controller/ElFinderController.php — the show and connect actions, and what the connector route name actually is (ef_connect / elfinder in the upstream bundle).
  3. Resources/config/routing.yml — route names, because every integration you write will reference them.
  4. The Twig helper (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.

Implementation Patterns

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.

Gotchas and Tips

  • Framework mismatch is the headline gotcha. Symfony2 APIs (%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.
  • The connector must never return an auth redirect. If your firewall sends an unauthenticated AJAX request to a login HTML page, elFinder shows a generic "unable to connect" and you'll chase config for an hour. Check the Network tab: if the connector response starts with <!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 404. The bundle's JS/CSS must be published (assets:install --symlink). In prod, re-run after deploy; symlinked assets + open_basedir restrictions break silently.
  • Permissions on the root directory. The PHP process needs write access for upload/rename/delete. Failures surface as elFinder's generic "errUploadFile" with no server log line. Check var/logs/ and PHP error log together.
  • Duplicate root aliases collide in the sidebar and produce confusing cross-root operations. Give every root a unique alias.
  • Security defaults are permissive. Set 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.
  • Debugging the connector quickly: open the connect URL directly in the browser while authenticated. You get raw JSON — readable errors instead of a silent UI. On the client side, enable elFinder's debug flag and watch the XHR payloads.
  • Config is cached. After editing fm_elfinder instances, clear the Symfony cache (--env=prod too). Half of "my config change did nothing" reports are stale container caches.
  • Config key names drift between forks. 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.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource