hoaaah/yii2-startbootstrap-sb-admin-2-asset
Composer 安装命令:
composer require hoaaah/yii2-startbootstrap-sb-admin-2-asset
包简介
This extensions is library for Startbootstrap SB Admin 2 Template with Bootstrap4
关键字:
README 文档
README
This packages contans an Asset Bundle of Startbootstrap SB Admin 2 for Yii2.
Startbootstrap SB Admin 2 is a responsive Bootstrap 4 created by Start Bootstrap.
Preview
Start Bootstrap was created by and is maintained by David Miller, Owner of Blackrock Digital.
Start Bootstrap is based on the Bootstrap framework created by Mark Otto and Jacob Thorton.
Requirement
This Asset Bundle need Bootstrap 4. Since Yii2 used Bootstrap 3 by default, you must install and change every Bootstrap 3 Asset to Bootstrap 4. You can read this tutorial to migrate to Yii2 Bootstrap 4 :
- English : How to use a Bootstrap 4 theme with Yii2
- Bahasa Indonesia : Pemrograman Web dengan Yii2 - Menggunakan Bootstrap 4
Installation
The preferred way to install this extension is through composer.
Either run
composer require hoaaah/yii2-startbootstrap-sb-admin-2-asset:dev-master
or add
"hoaaah/yii2-startbootstrap-sb-admin-2-asset": "*"
to the require section of your composer.json file.
Usage
You can see views-examples folder for example use of this library
Menu Widget
You can use Menu widget in your sidebar. This widget optimize for Startbootstrap SB-Admin 2 template. This widget, like SB-Admin 2, only support 2 level menu.
You can see example use of this widget in views-exampale/views/layout/sidebar.php.
use hoaaah\sbadmin2\widgets\Menu; echo Menu::widget([ 'options' => [ 'ulClass' => "navbar-nav bg-gradient-primary sidebar sidebar-dark accordion", 'ulId' => "accordionSidebar" ], // optional 'brand' => [ 'url' => ['/'], 'content' => <<<HTML <div class="sidebar-brand-icon rotate-n-15"> <i class="fas fa-laugh-wink"></i> </div> <div class="sidebar-brand-text mx-3">SB Admin <sup>2</sup></div> HTML ], 'items' => [ [ 'label' => 'Menu 1', 'url' => ['/menu1'], // Array format of Url to, will be not used if have an items 'icon' => 'fas fa-fw fa-tachometer-alt', // optional, default to "fa fa-circle-o 'visible' => true, // optional, default to true // 'options' => [ // 'liClass' => 'nav-item', // ] // optional ], [ 'type' => 'divider', // divider or sidebar, if not set then link menu // 'label' => '', // if sidebar we will set this, if divider then no ], [ 'label' => 'Menu 2', // 'icon' => 'fa fa-menu', // optional, default to "fa fa-circle-o 'visible' => true, // optional, default to true // 'subMenuTitle' => 'Menu 2 Item', // optional only when have submenutitle, if not exist will not have subMenuTitle 'items' => [ [ 'label' => 'Menu 2 Sub 1', 'url' => ['/menu21'], // Array format of Url to, will be not used if have an items ], [ 'label' => 'Menu 2 Sub 2', 'url' => ['/menu22'], // Array format of Url to, will be not used if have an items ], ] ], [ 'label' => 'Menu 3', 'visible' => true, // optional, default to true // 'subMenuTitle' => 'Menu 3 Item', // optional only when have submenutitle, if not exist will not have subMenuTitle 'items' => [ [ 'label' => 'Menu 3 Sub 1', 'url' => ['/menu21'], // Array format of Url to, will be not used if have an items ], [ 'label' => 'Menu 3 Sub 2', 'url' => ['/menu22'], // Array format of Url to, will be not used if have an items 'linkOptions' => [ 'onClick' => 'alert("This is onClick")', ] ], ] ], ] ]);
As you can see in above example, this Widget consist of two primary method.
| Method | Explanation |
|---|---|
options |
Optional method. in this metod you will set any costumization of this Menu widget. It consist of ulClass method and ulId method |
-- ulClass |
Set your <ul> class of this menu. default to "navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" |
-- ulId |
Set your <ul> id of this menu. default to "accordionSidebar" |
items |
Required method. You must set this method in your widget. You can set items inside this method and it will create sub-menu items. Items and Sub Menu Item method use the same method, except for type method. |
-- type |
Optional parameter, there are 3 category in this params. They are menu, divider, and sidebar. Default value of this params are menu |
-- label |
Required parameter. This param will give label to your menu |
-- icon |
Optional parameter. Will use font-awesome icon, so the value of this param will use fa class. Default to fas fa-circle |
-- url |
Required parameter. Use Array value, like array on \yii\helpers\Url::to($array). If there are items parameter set, url will be ignored |
-- visible |
Optional paremeter. Determined the visibility of menu. Value of visible are boolean. Default to true |
-- linkOptions |
Optional paremeter. This param use array, give any options param to a tag, such as onClick or other options in link. |
Card Widget
You can use card widget. This widget will create bootstrap card, optimize for this template
Example use of card are like below code
use hoaaah\sbadmin2\widgets\Card; echo Card::widget([ 'type' => 'cardBorder', 'label' => 'Label', 'sLabel' => '1000', 'icon' => 'fas fa-calendar', 'options' => [ 'colSizeClass' => 'col-md-3', 'borderColor' => 'primary', ] ]);
As you can see in above example, this Widget consist of some method.
| Method | Explanation |
|---|---|
type |
Optional method. In this method you set type of your card. This widget support this type of card: cardBorder, ..... Default value of type is cardBorder |
label |
Required method. In this method you set primary label of your card |
sLabel |
Required method. In this method you set secondary label of your card |
icon |
Required method. In this method you set icon of your card |
options |
options method. Set options, available options are colSizeClass, borderColor |
-- colSizeClass |
Set your col-size, value of this method are bootstrap col-size |
-- borderColor |
Set your borderColor, value of this method are bootstrap color |
TODO
Todo Widget
- Menu
- CardBorder
- CardBox
- HeaderMenu
- HeaderColor based on Params
- Etc
Creator
This asset wrapper was created by and is maintained by hoaaah.
hoaaah/yii2-startbootstrap-sb-admin-2-asset 适用场景与选型建议
hoaaah/yii2-startbootstrap-sb-admin-2-asset 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.84k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 11 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「extension」 「yii2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hoaaah/yii2-startbootstrap-sb-admin-2-asset 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hoaaah/yii2-startbootstrap-sb-admin-2-asset 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hoaaah/yii2-startbootstrap-sb-admin-2-asset 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A custom URL rule class for Yii 2 which allows to create translated URL rules
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
UI Kit 3 Extension for Yii2
Adds more BBCode
Define your own css rule-sets for the TYPO3 CMS backend.
统计信息
- 总下载量: 3.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-11-01