friendsofvictoire/file-widget
A file management widget for Laravel that adds upload, browse, and preview controls to your admin panels or dashboards. Drop it into a view, point it at a disk, and manage files without building custom UI.
Reality check first: this is not a Laravel package. friendsofvictoire/file-widget is a Symfony bundle built for Victoire DCMS (a Symfony 2.x–era CMS). There is no service provider, no config/file-widget.php, no Blade views, no Eloquent model, no facade. Composer will happily autoload its classes into a Laravel app, but they reference the Symfony HTTP kernel, Twig, Doctrine, and Victoire's widget base classes — nothing boots without that stack.
Where to look first (in the repo, in this order):
composer.json — the version constraints tell you the era (expect symfony/* ~2.7|~2.8, php >=5.5, a dependency on victoire/widget-bundle).WidgetFileBundle.php — the DI extension; almost certainly trivial (services, maybe a form type registration).Entity/WidgetFile.php — the actual data model: typically a title, a file reference owned by Victoire's media manager, and maybe a label.Form/WidgetFileType.php — the editor-facing UX; this is where the file picker integration lives.Resources/views/WidgetFile/{edit,show}.html.twig — the real contract. The templates reveal which entity fields actually exist.First use case if you genuinely run Victoire: composer require friendsofvictoire/file-widget, register the bundle in AppKernel.php after the Victoire bundles, clear the cache, open a page in the Victoire editor, drop the "File" widget into a slot, pick a file from the media manager, publish. That's the whole feature: an editor-inserted downloadable file link.
First use case in Laravel: there isn't one. The only honest starting point is to read the entity + templates as a spec and rebuild it natively (see below).
Patterns the bundle itself follows (relevant if you maintain the host Symfony app):
show.html.twig with it. Your job is markup, not orchestration.Resources/views/WidgetFile/show.html.twig into app/Resources/WidgetFileBundle/views/WidgetFile/show.html.twig to change output. This is the intended extension point and it keeps you off a fork.target="_blank") via a form type extension or subclass. Changing the widget's registered name breaks every existing page.The Laravel translation you'd actually ship in a day:
// migration
Schema::create('widgets', function (Blueprint $t) {
$t->id();
$t->string('type'); // 'file'
$t->string('slot');
$t->json('payload'); // { media_id, title, label }
$t->timestamps();
});
spatie/laravel-medialibrary (or plain Storage) for the file; store only the media id in payload.// app/Widgets/WidgetRegistry.php
public function render(Widget $w): string {
return view("widgets.{$w->type}", ['widget' => $w])->render();
}
resources/views/widgets/file.blade.php resolves the media to a URL and emits a download link with mime/size.FormRequest + policy; validation lives there, not in the component.payload shape and expose it via a JSON resource — the storage contract is the thing worth copying from the original.Integration tip: the one idea worth stealing from Victoire is the stable type key plus free-form payload. It lets you add widget kinds later without migrations and keeps rendered archives readable.
composer require this into a Laravel app expecting it to work. Autoload succeeds, nothing else does, and the Symfony 2.x constraints will either fail resolution outright or drag your dependency graph back a decade.VictoireWidgetBundle/core, the widget silently never appears in the editor. No error, just absence.assets:install, symlinks, and chmod on the upload dir are the usual suspects.edit.html.twig / show.html.twig. Don't trust class names.How can I help you explore Laravel packages today?