botble/assets
Composer 安装命令:
composer require botble/assets
包简介
Laravel assets management
README 文档
README
Installation
composer require botble/assets
For version <= 5.4:
Add to section providers of config/app.php:
// config/app.php 'providers' => [ ... Botble\Assets\Providers\AssetsServiceProvider::class, ];
And add to aliases section:
// config/app.php 'aliases' => [ ... 'Assets' => Botble\Assets\Facades\AssetsFacade::class, ];
All assets resource will be manage in config file so we need to publish config to use.
php artisan vendor:publish --provider="Botble\Assets\Providers\AssetsServiceProvider" --tag=config
Add to your master layout view, in head tag:
{!! \Assets::renderHeader() !!}
and before body tag close:
{!! \Assets::renderFooter() !!}
Methods
Add scripts
\Assets::addScripts(['key-of-assets-in-config-file']);
Example:
\Assets::addScripts(['app', 'bootstrap', 'jquery']);
Add styles
\Assets::addStyles(['key-of-assets-in-config-file']);
Example:
\Assets::addStyles(['bootstrap', 'font-awesome']);
Remove scripts
\Assets::removeScripts(['key-of-assets-in-config-file']);
Example:
\Assets::removeScripts(['bootstrap']);
Remove styles
\Assets::removeStyles(['key-of-assets-in-config-file']);
Example:
\Assets::removeStyles(['font-awesome']);
Others
- Set version for assets. Add to
.env
ASSETS_VERSION=1.0
Then all assets will be added ?v=1.0
- Change to online mode
ASSETS_OFFLINE=false
Then assets will be loaded from CDN if it's defined in config file.
- To disable versioning:
ASSETS_ENABLE_VERSION=false
Contributors
License
MIT © Sang Nguyen
botble/assets 适用场景与选型建议
botble/assets 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 292.26k 次下载、GitHub Stars 达 46, 最近一次更新时间为 2018 年 10 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「botble」 「botble cms」 「botble platform」 「botble assets」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 botble/assets 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 botble/assets 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 botble/assets 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Check coding standard & code syntax with Git pre-commit hook.
Dev tool commands for Botble CMS
API package for Botble CMS
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
统计信息
- 总下载量: 292.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 47
- 点击次数: 24
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-23