Weave Code
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

Filament Browser Laravel Package

tomatophp/filament-browser

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Laravel Native Integration: Built for Laravel/Filament, leveraging Filament’s admin panel ecosystem. Aligns with Laravel’s service provider, blade view, and filesystem abstractions.
  • Modular Design: Lightweight (no heavy dependencies) and focused on file management, making it a clean addition to existing Laravel projects.
  • Super-Admin Scope: Explicitly designed for restricted access (super-admins), reducing security risks in multi-role applications.

Integration Feasibility

  • Filament Dependency: Requires Filament v2+ (Laravel admin panel). If Filament is already in use, integration is straightforward; otherwise, adds complexity.
  • Filesystem Abstraction: Uses Laravel’s Storage facade, enabling flexibility (local, S3, etc.). Custom storage adapters may need validation.
  • Code Editor: Built-in Monaco editor (VS Code-like) for Markdown/code editing, but requires frontend JS compatibility (Vite/Laravel Mix).

Technical Risk

  • Security: High risk if misconfigured (e.g., exposing sensitive files). Must enforce strict role-based access (e.g., via Filament policies).
  • Performance: Heavy file operations (e.g., recursive scans) could impact large directories. May need async processing or caching.
  • Frontend Dependencies: Monaco editor adds ~1MB JS bundle. Ensure build tooling (Vite/Webpack) supports dynamic imports to avoid bloating production.
  • Edge Cases: No clear handling for symbolic links, permission errors, or cross-platform path issues (e.g., Windows/Linux).

Key Questions

  1. Filament Version: Is Filament v2+ already in use? If not, what’s the upgrade path?
  2. Storage Backend: Does the project use custom storage adapters (e.g., S3, FTP)? Test compatibility.
  3. Editor Customization: Are there needs for syntax highlighting beyond Markdown/PHP/JS?
  4. Audit Logging: Is file activity (create/rename/delete) logged for compliance?
  5. Rate Limiting: Are there safeguards against brute-force file operations (e.g., recursive deletes)?

Integration Approach

Stack Fit

  • Laravel Core: Seamless with Laravel’s filesystem, auth, and blade templating.
  • Filament Ecosystem: Designed for Filament’s widget system (e.g., Filament\Panel). Can be embedded as a dedicated resource or sidebar widget.
  • Frontend: Requires Vite/Webpack for Monaco editor. Ensure Laravel’s asset pipeline supports dynamic imports.

Migration Path

  1. Prerequisites:
    • Install Filament (composer require filament/filament).
    • Verify Laravel 9+ and PHP 8.1+ compatibility.
  2. Installation:
    composer require tomatophp/filament-browser
    
  3. Configuration:
    • Publish config (php artisan vendor:publish --tag="filament-browser-config").
    • Define allowed paths in config/filament-browser.php (e.g., storage/app/public).
  4. Access Control:
    • Register a Filament policy to restrict access (e.g., SuperAdmin gate).
    • Example:
      Filament::registerPolicy(SuperAdmin::class, [
          FilamentBrowser::class => ['view', 'edit'],
      ]);
      
  5. Frontend Setup:
    • Ensure resources/js/app.js imports Monaco editor (if not auto-included).
    • Test in a staging environment with a subset of files.

Compatibility

  • Laravel: Tested on Laravel 9+. May need adjustments for older versions (e.g., Facade changes).
  • Filament: Requires Filament v2+. Check for breaking changes in Filament v3.
  • Storage: Defaults to public_path(). For custom storage (e.g., S3), extend Tomato\FilamentBrowser\Contracts\StorageAdapter.
  • Browser Support: Monaco editor supports modern browsers (Chrome, Firefox, Edge). Test IE11 if required.

Sequencing

  1. Phase 1: Install and configure in a dev environment. Test basic file browsing.
  2. Phase 2: Implement access control and audit logging.
  3. Phase 3: Customize editor/toolbar (e.g., add GitHub Flavored Markdown).
  4. Phase 4: Load-test with large directories (e.g., 10K+ files).
  5. Phase 5: Deploy to staging with monitoring for file operation latency.

Operational Impact

Maintenance

  • Updates: MIT license allows forks. Monitor for Filament major version updates (e.g., v2 → v3).
  • Dependencies: Monaco editor (~1MB) may need occasional updates. Use npm outdated to track.
  • Configuration: Centralized in config/filament-browser.php. Changes require no code deployments.

Support

  • Documentation: README is basic. Expect to document:
    • Access control setup.
    • Custom storage adapters.
    • Editor customization (e.g., themes).
  • Troubleshooting:
    • Permission Errors: Verify storage directory permissions (chmod -R 755 storage).
    • Editor Failures: Clear browser cache or check for JS errors in console.
    • Performance: Add cache() to file listings for large directories.

Scaling

  • Large Directories:
    • Implement lazy-loading for file listings (e.g., paginate results).
    • Use Laravel’s Storage::disk()->files() with limit() for initial load.
  • Concurrency:
    • File operations (e.g., renames) may conflict. Consider file locks (Storage::lock()).
    • Queue long-running operations (e.g., recursive deletes) with Laravel Queues.
  • Storage Backends:
    • For S3, test performance with flysystem caching.
    • Avoid listing entire buckets; scope to prefixes (e.g., s3://bucket/path/*).

Failure Modes

Failure Scenario Impact Mitigation
Unauthorized access Data leakage Strict Filament policies + IP whitelisting
Monaco editor JS errors Broken UI Fallback to simple text editor
Storage backend timeouts Hanging requests Set storage timeout in config
Recursive delete crashes Server overload Disable recursive ops or add confirmation
Path traversal attacks Arbitrary file access Sanitize paths (e.g., Str::of()->afterLast('/'))

Ramp-Up

  • Developer Onboarding:
    • 1 Hour: Install and test basic browsing.
    • 2 Hours: Configure access control and custom paths.
    • 4 Hours: Customize editor/toolbar (if needed).
  • Non-Technical Users:
    • Provide a video demo of file operations (create/rename/delete).
    • Highlight risks (e.g., "Do not use for production media").
  • Training:
    • Focus on:
      • Path restrictions (e.g., "Only use /storage/app/public").
      • Editor shortcuts (e.g., Ctrl+S to save).
      • Audit logging (if enabled).
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.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony