aslani / yii2-bootstrap5-rtl
Twitter Bootstrap 5 RTL extension for the Yii 2.0 framework
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- bower-asset/bootstrap: ^5.0
- yiisoft/yii2: ~2.0.0
This package is not auto-updated.
Last update: 2025-06-10 07:24:36 UTC
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/bootstrap
via 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/bootstrap
package. - If you see an error related to
@bower
alias, 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