hadiabedzadeh/static-assets 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hadiabedzadeh/static-assets

Composer 安装命令:

composer require hadiabedzadeh/static-assets

包简介

Combine and serve combined CSS/JS assets with simple cache-busting

README 文档

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)

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-27