hadiabedzadeh / static-assets
Combine and serve combined CSS/JS assets with simple cache-busting
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/hadiabedzadeh/static-assets
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2025-09-27 13:09:52 UTC
README
A PHP package for combining and optimizing CSS/JS files with cache support and framework integration.
📦 Installation
composer require hadiabedzadeh/static-assets
🚀 Usage
use hadiabedzadeh\StaticAssets\StaticAssets; echo StaticAssets::combineFiles([ 'assets/src/style1.css', 'assets/src/style2.css' ], 'css', 'my-segment'); echo StaticAssets::combineFiles([ 'assets/src/app.js', 'assets/src/utils.js' ], 'js', 'my-segment', 'async');
⚡ With Laravel
Example inside a Blade template:
{!! hadiabedzadeh\StaticAssets\StaticAssets::combineFiles([ public_path('css/app.css'), public_path('css/theme.css') ], 'css', 'laravel', 'defer', public_path(), asset('')) !!}
🏛️ With Symfony
Example inside a Twig template:
{{ hadiabedzadeh\StaticAssets\StaticAssets.combineFiles([ 'assets/css/app.css', 'assets/css/theme.css' ], 'css', 'symfony', 'defer', project_root ~ '/public', asset(''))|raw }}
⚙️ Options
-
$files: Array of file paths
-
$type: 'css' or 'js'
-
$segment: Output folder name (defaults to first URL segment)
-
$jsLoad: '' | 'defer' | 'async'
-
$publicPath: Filesystem path to public folder (defaults to getcwd() . '/public')
-
$publicUrl: Base URL for assets (optional)