arthusantiago/bootstrap-for-cakephp
Composer 安装命令:
composer require arthusantiago/bootstrap-for-cakephp
包简介
Automatically copy Bootstrap and Bootstrap Icons assets to CakePHP webroot directory
README 文档
README
Automatically copy Bootstrap and Bootstrap Icons assets to your CakePHP webroot/ directory when packages are installed or updated via Composer.
Features
- ✨ Automatic copying of Bootstrap CSS and JS files
- ✨ Automatic copying of Bootstrap Icons CSS and fonts
- 🚀 Works with Composer package install/update hooks
- 🛠️ Manual CLI command for on-demand copying
- ✅ Fully compatible with CakePHP 4.x and 5.x
- 🔧 Customizable configuration and paths
- 📝 Comprehensive logging via Composer IO interface
Installation
Install the package via Composer:
composer require arthusantiago/bootstrap-for-cakephp
Then ensure you have Bootstrap installed:
composer require twbs/bootstrap twbs/bootstrap-icons
How It Works
This package automatically detects when Bootstrap or Bootstrap Icons are installed or updated via Composer, and copies the necessary files to your CakePHP webroot/ directory:
- Bootstrap CSS/JS →
webroot/css/andwebroot/js/ - Bootstrap Icons →
webroot/css/andwebroot/css/fonts/
Usage
Automatic (Recommended)
Once installed, the package automatically copies assets whenever you:
composer install composer update composer require twbs/bootstrap composer update twbs/bootstrap
Manual Copy
If you need to manually copy assets, use the CLI command:
# Copy all supported packages automatically composer copy-bootstrap-assets # Or copy specific package assets composer copy-bootstrap-assets twbs/bootstrap twbs/bootstrap-icons # Or copy each one individually composer copy-bootstrap-assets twbs/bootstrap composer copy-bootstrap-assets twbs/bootstrap-icons
Advanced Usage
Customizing Asset Paths
Extend the AssetsConfig class to customize where assets are copied:
<?php // config/AssetsConfig.php namespace App\Config; use ArthuSantiago\BootstrapForCakePHP\AssetsConfig; class MyAssetsConfig extends AssetsConfig { protected static string $webrootPath = 'custom_webroot'; // Override package configuration protected static array $packages = [ // ... custom configuration ]; }
Then register your custom config in composer.json:
{
"scripts": {
"post-install-cmd": [
"ArthuSantiago\\BootstrapForCakePHP\\BootstrapAssets::setupAssets"
]
}
}
Custom Implementations
Extend BootstrapAssets to implement custom logic:
<?php namespace App\Tools; use ArthuSantiago\BootstrapForCakePHP\BootstrapAssets; use Composer\Script\Event; class CustomBootstrapAssets extends BootstrapAssets { public static function setupAssets(Event $event): void { parent::setupAssets($event); // Add custom logic here // e.g., compile SCSS, minify files, etc. } }
Running Tests
First, install development dependencies:
composer install
Then run the test suite:
# Run all tests composer test # Or run directly with PHPUnit vendor/bin/phpunit # List all available tests vendor/bin/phpunit --list-tests # Run specific test file vendor/bin/phpunit tests/TestCase/FileOperationsTest.php # Run specific test method vendor/bin/phpunit --filter testCopyFileShouldCopyFileSuccessfully # Run tests from specific testsuite vendor/bin/phpunit --testsuite "Bootstrap Assets Test Suite"
Requirements
- PHP 8.1 or higher
- CakePHP 4.0 or higher
- Composer 2.0 or higher
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests to improve this package.
Support
If you encounter any issues, please open an issue on the GitHub repository.
arthusantiago/bootstrap-for-cakephp 适用场景与选型建议
arthusantiago/bootstrap-for-cakephp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 324 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「assets」 「bootstrap」 「composer」 「cakephp」 「bootstrap-icons」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 arthusantiago/bootstrap-for-cakephp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arthusantiago/bootstrap-for-cakephp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 arthusantiago/bootstrap-for-cakephp 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Asset Management for PHP
Caching and compression for Twig assets (JavaScript and CSS).
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
Views for the package MedicOneSystems Livewire Datatables with Bootstrap 4
Tool for loading or deploying CSS and JS files into web pages
统计信息
- 总下载量: 324
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-27