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

Laravel Filemanager Laravel Package

opensid/laravel-filemanager

Laravel file manager package for browsing, uploading, and managing files and images through a ready-made UI. Integrates with Laravel apps to handle storage, previews, and common file operations, useful for adding an admin-friendly media browser without building one from scratch.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install with composer require opensid/laravel-filemanager:^1.1 (or the package's distribution name in your project) and publish its config and assets. The publish tags are worth checking in the repo README the first time — they are the thing most likely to differ between forks.
  • Publish the config (php artisan vendor:publish --tag=<package>_config) and open it before writing any code. This is where the accepted extensions, upload size limit, storage disk, per-user base directory, and the content-validation toggle live. Almost every "the package is doing something weird" issue is really a config default.
  • Required runtime bits: PHP fileinfo extension (the magic-byte checks depend on it), gd or imagick for thumbnail generation, and a configured filesystem disk (usually public with php artisan storage:link).
  • Wire the routes through middleware you control. Out of the box the package registers its routes on web; add auth (or your own gate) so uploads aren't anonymously writable.
  • First use case: open the file manager UI in a browser, upload a high-entropy JPEG/PNG screenshot, then upload the same image renamed to .php. In v1.1.0 the image must pass and the renamed file must be rejected with a readable wrong extension / size message. If you see the literal string "...maximale size of %d MB.", your translations are stale — that bug is fixed in this release.
  • Where to look first when something misbehaves: (1) the published config, (2) the FileContentValidator class for the signature table, (3) the package's resources/lang / lang/vendor files for the message keys (max_size_reached, wrong_extension), (4) your config/filesystems.php disk definition.

Implementation Patterns

  • WYSIWYG integration. The common day-to-day use is as a picker for TinyMCE or CKEditor. Point the editor's file-browser URL at the package route with the type=image (or type=file) query parameter and expect a JSON response containing the file location. This is where you'll spend most integration time — return shapes differ between editor versions.
  • Standalone manager. For non-editor uploads, embed the manager route in an iframe or modal and use its callback/postMessage hook to hand the selected path back to your form. Keep the iframe on the same origin.
  • Per-user directories. Scope uploads by configuring a base directory or by wrapping the routes in middleware that sets the user folder. Don't rely on the client to send a folder name — resolve it server-side from auth()->id().
  • Reuse the validator outside the manager. FileContentValidator is useful as a general Laravel validation rule for any upload endpoint, not just the file manager. That gives you consistent magic-byte enforcement across ProfileController, DocumentController, etc., without duplicating signature tables.
  • Extending the accept-list. When you need a new type (e.g. .webm, .heic), add it in two places: the config's extension allow-list and a signature entry in the validator. Adding only the extension re-opens the exact spoofing hole the validator exists to close.
  • Post-upload processing. Hook image resizing, virus scanning, or metadata extraction after the package stores the file — via filesystem/Storage events or by decorating the upload controller — rather than editing vendor code. Keep the package upgradeable.
  • Testing. Use Storage::fake('public') with UploadedFile::fake()->image(...) for the happy path, and commit a small binary fixture for the rejection path (a real JPEG containing a <?php fragment). Since v1.1.0 specifically fixed false rejections on high-entropy images, keep a real screenshot fixture in the suite so future signature changes don't regress it.

Gotchas and Tips

  • The polyglot check is a heuristic, not a guarantee. v1.1.0 tightened the <?= and bare <? detection so random compressed image bytes no longer trip it, but a determined attacker can still craft a payload the scanner misses. The validator is defense in depth — also make sure the upload directory can't execute PHP (php_flag engine off, or store on a non-executing disk/S3).
  • Stale fileinfo magic database = false rejections. If valid images suddenly fail after a server migration, check php -i | grep fileinfo and the system magic file before blaming the package.
  • Offset-based checks need seekable files. v1.1.0 added far offsets (iso at byte 32769) and negative offsets from EOF (the koly trailer on dmg). These work on local temp files but can break on streamed or S3-backed uploads where the temp file isn't a real path. If you use a remote disk, make sure the upload is materialized locally first.
  • Do you actually need iso/dmg? Each new signature widens the accepted surface. For a typical CMS or intranet, removing exotic types from the allow-list is a cheaper win than relying on signature checks.
  • Size-limit messages: use :size, not %d. The v1.1.0 fix means the max_size_reached translation now interpolates Laravel-style placeholders, and the controller passes the configured max_upload_size. If you've overridden the language file with the old %d text, you'll reintroduce the bug — update your published translations after upgrading.
  • Config value ≠ server limit. The configured max_upload_size may be larger than upload_max_filesize/post_max_size in php.ini; oversized requests then fail with an opaque UPLOAD_ERR_INI_SIZE before the package's own message ever shows. Keep the two in sync, or users see a generic error.
  • Clear caches after config edits. php artisan config:clear (and view:clear after touching assets). Silent config caching is the most common reason a setting "doesn't work".
  • Filename hygiene is still your job. Sanitize names, reject .. and null bytes, and don't trust the client-supplied extension even after validation — derive the stored name server-side.
  • Debugging failures: log the validator's rejection reason alongside the file's detected MIME and size; that single line distinguishes "legitimate user with an odd image" from "someone probing the uploader" far faster than Laravel's generic validation exception.
  • Upgrade path is low-risk. v1.1.0 is additive (new signatures) plus two bug fixes (polyglot false positives, size message) with no noted breaking changes or deprecations. composer update, re-check any published language files, and re-run your upload tests — particularly the image-upload path, which is what the release was mainly fixing.
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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core