aslani/yii2-bootstrap5-rtl
最新稳定版本:v1.0.2
Composer 安装命令:
composer require aslani/yii2-bootstrap5-rtl
包简介
Twitter Bootstrap 5 RTL extension for the Yii 2.0 framework
README 文档
README
This is a Yii2 AssetBundle that replaces the default Bootstrap 5 CSS file with its Right-to-Left (RTL) version.
It is useful for web applications that use RTL languages such as Persian, Arabic, Hebrew, etc.
📦 Installation
The preferred way to install this extension is through Composer.
Run the following command:
composer require aslani/yii2-bootstrap5-rtl
Or add this line to the require section of your composer.json file:
"aslani/yii2-bootstrap5-rtl": "*"
Then run:
composer update
⚠️ Make sure you have installed
bower-asset/bootstrapvia Composer. This package relies on that to load the RTL CSS file.
⚙️ Usage
In order to use the RTL version of Bootstrap in your Yii2 application, you just need to replace the default BootstrapAsset with BootstrapRtlAsset in your AppAsset (or any other AssetBundle).
Example:
namespace app\assets; use yii\web\AssetBundle; class AppAsset extends AssetBundle { public $basePath = '@webroot'; public $baseUrl = '@web'; public $css = [ 'css/site.css', ]; public $js = []; public $depends = [ 'yii\web\YiiAsset', //'yii\bootstrap\BootstrapAsset', // Remove or comment this line 'aslani\bootstrap5\BootstrapRtlAsset', // Use this instead ]; }
This will make sure the following file is loaded instead of the default Bootstrap CSS:
vendor/bower-asset/bootstrap/dist/css/bootstrap.rtl.min.css
🛠️ AssetBundle Details
The class provided by this package:
aslani\bootstrap5\BootstrapRtlAsset
Loads the following CSS file:
@bower/bootstrap/dist/css/bootstrap.rtl.min.css
If you are using an alternative path or a custom version of Bootstrap RTL, you can override the $sourcePath or $css property accordingly.
💡 Tips
- You may need to manually include an RTL-compatible version of Bootstrap 5 if it’s not available by default in your
bower-asset/bootstrappackage. - If you see an error related to
@boweralias, add this in your Yii2 config or bootstrap file:
Yii::setAlias('@bower', dirname(__DIR__) . '/vendor/bower-asset');
🪪 License
This project is released under the BSD-3-Clause License.
See the LICENSE file for details.
🙋 Support
🧑 Author
Mehdi Aslani
📧 Email: aslani.mhd@gmail.com
📦 Packagist: aslani/yii2-bootstrap5-rtl
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2022-12-21