static-assets/laravel
最新稳定版本:1.0.0
Composer 安装命令:
composer require static-assets/laravel
包简介
Static Assets laravel helper package
README 文档
README
This Static Assets package enables your Laravel app's static assets to be remotely compiled and hosted.
You'll no longer need to install Node.js onto your hosts just for asset compilation. Plus get all the benefits of remote management including faster compilation times, reduced resource utilization, CDN hosting and more.
To learn about what Static Assets can do for you and to set up your account, visit staticassets.app.
Requirements
- PHP >= 8.1
- Laravel >= 9.0
Features
- Use remotely generated and hosted Vite or Mix compiled files.
- Choose between storing updated Vite / Mix manifest file on disk or in cache.
Installation
composer require static-assets/laravel
You'll also need to install the Vite or Mix package for your Laravel app.
Instructions to install Vite package
Instructions to install Laravel Mix package
Configuration
The package can be configured using the following .env variables.
By default, none of the following variables are required. Default behaviours are defined below.
Enable / Disable the Package
STATIC_ASSETS=true
Default: true when APP_ENV is production, false otherwise.
Manifest Storage
We store the manifest compiled by Static Assets either on your default disk or in the cache.
Valid values are: disk or cache.
STATIC_ASSETS_STORAGE=disk
By default, the Static Assets compiled manifest will be stored on the default disk.
Manifest Cache Timeout (Cache only)
When storing the Static Assets manifest in the cache, you can specify the number of days the manifest should be cached for.
STATIC_ASSETS_CACHE_TIMEOUT=90
By default, the Static Assets compiled manifest will be cached for 30 days.
Specify Release
We reference static assets by their git hash. Here you're able to define a specific release to use.
It's expected that this is likely only useful when debugging or testing.
STATIC_ASSETS_RELEASE=0e5eb38d172ceed3735ecae5a02767c8c945b31c
By default, the latest git commit hash is used.
trim(exec('git --git-dir '.base_path('.git').' rev-parse HEAD'))
Manifest Custom Directory
Should your Vite/Mix manifest not be stored in their default locations (/public or /public/build), you can specify the directory here.
# This non-default example will look for the manifest file in the
# /build directory of your project.
STATIC_ASSETS_DIRECTORY=build
By default, the package will look for the manifest file in the /public directory.
Publishing Configuration File
Whilst not required you can optionally also publish the configuration file using the following command:
php artisan vendor:publish --tag=static-assets-config
Changelog
Please see the packages GitHub Releases page for more information on what has changed recently.
Contributing
We welcome contributions to this package. Please submit a Pull Request and we'll review.
Security Vulnerabilities
We take security seriously at Static Assets. Any security issues should be reported to security@staticassets.app.
Credits
Static Assets is a product of Init Development Studios. We're proud members of the Laravel community and sponsor our local Laravel conference Laracon AU.
License
The MIT License (MIT). Please see License File for more information.
static-assets/laravel 适用场景与选型建议
static-assets/laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.89k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 11 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 static-assets/laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 static-assets/laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.89k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-23