PHPackages                             hollyit/filament-static-assets - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. hollyit/filament-static-assets

ActiveLibrary

hollyit/filament-static-assets
==============================

Improved handling of stylesheets and javascript files for Filament

0.1.4(3y ago)1512.9k↓100%3[2 issues](https://github.com/HollyIT/filament-static-assets/issues)MITPHPPHP ^8.0

Since Sep 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/HollyIT/filament-static-assets)[ Packagist](https://packagist.org/packages/hollyit/filament-static-assets)[ Docs](https://github.com/HollyIT/filament-static-assets)[ RSS](/packages/hollyit-filament-static-assets/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (7)Used By (0)

Filament Static Asset Handling
==============================

[](#filament-static-asset-handling)

This package aims to solve improve the static asset handling of the amazing Laravel package [Filament](https://filamentphp.com/).

---

**NOTE:** This package is for Filament served assets only. If you are looking for a general Laravel asset management system that includes the same features as this, plus advanced dependency management, then the newly released [Laravel Static Libraries](https://github.com/HollyIT/laravel-static-libraries) might be of interest.

---

By default Filament serves all static files (js and css) via Laravel. While this method is perfectly fine for smaller projects, it can become a performance hit once your project grows. To overcome the performance hit, this package will copy all your static assets to a path in your public directory, thereby allowing your webserver to directly handle the files. If you add a package with new files and forget run the command, no sweat, things will fallback directly to Filament's default handling.

Another feature of the caching mechanism is the addition of cache buster keys added to the actual URLs. These keys are based off of the filemtime of the original asset file, so even if you republish, browser caching will remain untouched.

To cache your static files, just run this simple command:

```
 php artisan filament:cache-assets
```

And to clear the files out, going back to the original method of handling files:

```
 php artisan filament:flush-assets
```

One problem with this method is that you may easily forget to run the commands when packages are updated. Therefor it is highly recommended to add a script to your composer.json file to handle this automatically:

```
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force",
            "@php artisan filament:upgrade",
            "@php artisan filament:cache-assets" // Add this line
        ],

        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    },
```

The second problem this package deals with is the loading of assets on every page. As projects grow and more static assets are added, this can be another performance hit. If you use a package like the [Filament Tiptap Edito](https://filamentphp.com/plugins/tiptap)r or [Filament Tiny Editor](https://filamentphp.com/plugins/tinyeditor), then those files load on every page, regardless of you needing them or not. To stop this, there are two events fired when rendering out scripts and stylesheets:

#### HollyIT\\FilamentStaticAssets\\Events\\PreProcessStaticAssetsEvent

[](#hollyitfilamentstaticassetseventspreprocessstaticassetsevent)

This event is fired before the files are processed and things like cache busting keys are added.

#### HollyIT\\FilamentStaticAssets\\Events\\PostProcessStaticAssetsEvent

[](#hollyitfilamentstaticassetseventspostprocessstaticassetsevent)

This event fires after all alterations are done to the files and ready to be rendered in the template.

Both methods expose the same properties:

`$event->files` is a collection of the actual files. So in the PreProcess event, you could remove a script file: `$event->files->forget('file_to_drop');`

`$event->domain` is the scope of the files. This can be either styles, scripts or beforeCoreScripts

Install
-------

[](#install)

```
composer require hollyit/filament-static-assets
```

One Note!
---------

[](#one-note)

To make all this possible, this package has to override the FilamentManager class provided by Filament. So If you are trying to do anything extra with that concrete class, keep in mind you'll have to echo the changes made by this class.

Testing
-------

[](#testing)

This package is fully tested with 100% coverage.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~43 days

Total

5

Last Release

1166d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/58617d67178941252c10067cd88583a4f1773569b630372930c6412fbc939979?d=identicon)[HollyIT](/maintainers/HollyIT)

---

Top Contributors

[![HollyIT](https://avatars.githubusercontent.com/u/527984?v=4)](https://github.com/HollyIT "HollyIT (8 commits)")

---

Tags

laravelperformanceassetsfilamenthollyit

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/hollyit-filament-static-assets/health.svg)

```
[![Health](https://phpackages.com/badges/hollyit-filament-static-assets/health.svg)](https://phpackages.com/packages/hollyit-filament-static-assets)
```

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[pboivin/filament-peek

Full-screen page preview modal for Filament

253319.6k12](/packages/pboivin-filament-peek)[croustibat/filament-jobs-monitor

Background Jobs monitoring like Horizon for all drivers for FilamentPHP

254255.2k6](/packages/croustibat-filament-jobs-monitor)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

124139.3k2](/packages/dotswan-filament-map-picker)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17554.3k2](/packages/stephenjude-filament-jetstream)[creagia/filament-code-field

A Filamentphp input field to edit or view code data.

58289.3k3](/packages/creagia-filament-code-field)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
