apsonex / filament-asset-routing
This is my package filament-asset-routing
v1.0.1
2023-09-15 13:44 UTC
Requires
- php: ^8.1
- filament/filament: ^3.0
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- nunomaduro/collision: ^7.9
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
This package is auto-updated.
Last update: 2024-10-15 16:21:48 UTC
README
Filament has built in system to manage assets. But for some reason i want to create a package which helps me in development also.
Purpose
<!-- component.blade.php --> @php use \Apsonex\FilamentSimpleFile\FilamentSimpleFileServiceProvider; @endphp <div ax-load x-load-css="[ @js(filament_asset_route('resources/dist/plugin.css', FilamentSimpleFileServiceProvider::class)), ]" ax-load-src="{{ filament_asset_route('resources/dist/plugin.js', FilamentSimpleFileServiceProvider::class) }}" />
Above code will create links and package will serve the file as requested with updated timestamp to purge the file cache by browser.
Installation
You can install the package via composer:
composer require apsonex/filament-asset-routing
Usage
use \Apsonex\FilamentAssetRouting\FilamentAssetRouting; use \Apsonex\FilamentImage\FilamentImageServiceProvider; FilamentAssetRouting::url('resources/dist/plugin.css', FilamentImageServiceProvider::class) // OUTOUT: https://example.com/package/filename.ext?id=file_timestamp // Authentication will be required to access the file FilamentAssetRouting::authUrl('resources/dist/plugin.css', FilamentImageServiceProvider::class) // OUTPUT: https://example.com/package/filename.ext?id=file_timestamp // authentication required
Helpers functions
filament_asset_route(string $filePath, string $serviceProviderClass) // Auth will be required to access the file filament_asset_route_auth(string $filePath, string $serviceProviderClass)
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.