Yii2 is a PHP framework that until now, april 2021, still use bootstrap 3. If you are okay with that, then Yii2 is an awesome framework. Yii2 give you flexibility to handle javascript and css through AssetBundle, a feature that i didnt found in another major framework like laravel, symphony etc.
BootstrapAsset is Yii2 AssetBundle to handle bootstrap css. Luckily we can configure the BootstrapAsset through web.php config file. Say that you want to apply theme to the bootstrap 3 you already have. You got a cool free theme from bootswatch.com and want apply that to your Yii2 apps. So this is what you need to do.
create folder inside @app/views folder for example we create 'flatly' folder here for your flatly theme
create 'css' folder inside the previous
create 'bootstrap.css' file inside the 'css' folder then copy the theme style into this file
add bellow line at the end of
if (YII_ENV_DEV)
definition inside the web.php config file
$config['components']['assetManager']['bundles']['yii\bootstrap\BootstrapAsset']['sourcePath'] = '@app/views/flatly';
thats it
Top comments (0)