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 Clear Cache Laravel Package

cms-multi/filament-clear-cache

Adds a “Clear Cache” button to your Filament admin toolbar so you can quickly run cache-clearing commands without leaving the panel. Supports Filament v2–v5 (via plugin versions) and configurable via a publishable config.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Filament Integration: The package is a Filament plugin, meaning it integrates seamlessly with the Filament admin panel (v2.x, v3.x, v4.x, and v5.x). This aligns well with Laravel-based projects using Filament for admin interfaces.
  • Cache Management: Leverages Laravel’s built-in optimize:clear command, which clears route, config, and view caches. This is a low-risk approach since it uses native Laravel functionality.
  • Extensibility: Supports custom cache commands (e.g., page-cache:clear), allowing TPMs to extend functionality for project-specific caching needs (e.g., Redis, Varnish, or custom cache stores).
  • UI/UX: Adds a non-intrusive toolbar button with a counter for cleared items (up to 99+), improving developer workflow without cluttering the interface.

Integration Feasibility

  • Minimal Boilerplate: Installation requires one Composer command and plugin registration in the Filament panel configuration (panel() method).
  • Conditional Activation: Supports environment-based toggling (e.g., disable in production), reducing accidental cache clears in live environments.
  • Livewire Compatibility: Works with Livewire v2/v3, ensuring smooth integration with Filament’s Livewire-based UI.
  • Translation Support: Includes German translations and uses translation keys for tooltips, making it adaptable to multilingual projects.

Technical Risk

  • Cache Side Effects:
    • Clearing caches may temporarily degrade performance (e.g., route caching rebuilds).
    • Risk of stale data if caches are cleared mid-transaction (mitigated by Filament’s session management).
  • Command Overrides:
    • Custom commands must be idempotent (e.g., avoid clearing caches that shouldn’t be cleared in all environments).
    • Potential for command conflicts if multiple packages extend cache clearing (unlikely but worth auditing).
  • Filament Version Lock:
    • Version 3.x supports Filament v4/v5, but backward compatibility with v2/v3 is maintained. Ensure the project’s Filament version is supported (check the compatibility table).
  • Testing Overhead:
    • Cache-clearing logic should be tested in CI/CD pipelines to avoid production incidents (e.g., failed cache clears during deployments).

Key Questions for TPM

  1. Cache Strategy:
    • Does the project use additional caching layers (e.g., Redis, Varnish) that need custom commands? If so, will optimize:clear suffice, or are custom commands required?
    • Are there critical caches (e.g., API responses, session data) that should never be cleared via this UI?
  2. Environment Safety:
    • Should the button be disabled in staging/production by default, or only in production? (Use the enabled() method.)
    • Are there role-based permissions needed to restrict cache clearing to specific users (e.g., admins only)?
  3. Performance Impact:
    • How frequently is cache clearing expected? Frequent clears (e.g., per-developer) may require monitoring for performance degradation.
    • Is there a need to log cache clear events for auditing or debugging?
  4. Deployment Integration:
    • Should cache clearing be automated during deployments (e.g., via Laravel Forge/Envoyer), reducing reliance on manual UI triggers?
  5. Customization Needs:
    • Are there UI customizations needed (e.g., button styling, tooltip text, or icon)?
    • Should the counter feature (showing cleared items) be disabled for certain environments?

Integration Approach

Stack Fit

  • Laravel + Filament: Native fit—designed for Filament admin panels, requiring no additional infrastructure.
  • PHP Version: Supports PHP 8.2+ (for Filament v4/v5) and 8.1+ (for v3). Ensure the project’s PHP version aligns with the target Filament version.
  • Cache Drivers: Works with all Laravel cache drivers (file, database, Redis, Memcached, etc.), but custom commands may be needed for non-standard setups (e.g., Varnish).
  • Livewire: Compatible with Livewire v2/v3, which Filament uses under the hood.

Migration Path

  1. Pre-Integration Checks:
    • Verify Filament version (v2.x–v5.x) and PHP version compatibility.
    • Audit existing cache-clearing workflows (e.g., Artisan commands, scripts) to avoid duplication.
  2. Installation:
    composer require cms-multi/filament-clear-cache
    
    • Publish config (optional):
      php artisan vendor:publish --provider="CmsMulti\FilamentClearCache\FilamentClearCacheServiceProvider"
      
  3. Plugin Registration: Add to app/Providers/Filament/AdminPanelProvider.php:
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->plugins([
                FilamentClearCachePlugin::make()
                    ->enabled(app()->environment(['local', 'staging'])),
            ]);
    }
    
  4. Customization (Optional):
    • Add custom commands in a service provider:
      use CmsMulti\FilamentClearCache\Facades\FilamentClearCache;
      
      public function boot()
      {
          FilamentClearCache::addCommand('page-cache:clear');
      }
      
    • Extend translations or UI via Filament’s plugin system.

Compatibility

  • Filament Versions:
    • v3.x: Supports Filament v2.x–v3.x (PHP 8.0+).
    • v2.x: Supports Filament v2.x only (legacy).
    • v3.x+: Supports Filament v4.x–v5.x (PHP 8.2+).
  • Laravel Versions:
    • Officially supports Laravel 11–13 (as of v3.x). Older versions may work but aren’t tested.
  • Dependencies:
    • No external dependencies beyond Filament and Laravel core.

Sequencing

  1. Development Phase:
    • Install and test in a local/staging environment first.
    • Validate that cache clears do not break critical workflows (e.g., API responses, real-time features).
  2. Staging/Pre-Production:
    • Enable the plugin in staging and monitor for performance impacts.
    • Test custom commands if added.
  3. Production:
    • Disable in production by default (use enabled() method) unless cache clearing is a manual requirement.
    • Consider automating cache clears during deployments instead of manual triggers.
  4. Post-Deployment:
    • Add monitoring for cache clear events (e.g., log entries, metrics).
    • Document the new workflow for developers (e.g., "Clear caches via Filament toolbar").

Operational Impact

Maintenance

  • Low Maintenance:
    • No database migrations or complex configurations required.
    • Updates can be handled via Composer (follow Laravel/Filament’s update guidelines).
  • Dependency Updates:
    • Monitor Filament and Laravel version support (e.g., Laravel 14 may require a plugin update).
    • Custom commands must be revalidated after major Laravel/Filament updates.
  • Configuration Drift:
    • Minimal risk of drift since the plugin is opinionated (only publishes optional config).

Support

  • Troubleshooting:
    • Common Issues:
      • Button not appearing: Check panel() registration and Filament version compatibility.
      • Cache not clearing: Verify optimize:clear permissions (e.g., storage directory writable).
      • Custom commands failing: Debug the underlying Artisan command.
    • Debugging Tools:
      • Use php artisan optimize:clear manually to test cache clearing.
      • Check Filament logs (storage/logs/filament.log) for plugin errors.
  • Support Channels:
    • GitHub Issues (active community, 53 stars).
    • Laravel/Filament Discord communities for broader context.

Scaling

  • Performance:
    • Cache Clearing Impact:
      • optimize:clear rebuilds route/config/view caches, which may cause brief latency spikes (mitigated by Filament’s session management).
      • For high-traffic sites, consider automating cache clears during low-traffic periods (e.g., via cron or deploy hooks).
    • Counter Feature:
      • The "cleared items" counter is client-side only (Livewire event) and does not impact server performance.
  • Concurrency:
    • Safe for multi-user environments (Filament handles session isolation).
    • No risk of race conditions in cache clearing (Artisan commands are atomic).

Failure Modes

| Failure Scenario | Impact | Mitigation | |-------------------------------------|

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