ricar2ce/yii2-material-theme
Composer 安装命令:
composer require ricar2ce/yii2-material-theme
包简介
Material Theme for Yii2
README 文档
README
Material UI for Yii2 Framework, based on Creative Tim Material Dashboard
Material Dashboard is a free Material Bootstrap Admin with a fresh, new design inspired by Google's Material Design. We are very excited to introduce our take on the material concepts through an easy to use and beautiful set of components. Material Dashboard was built over the popular Bootstrap framework and it comes with a couple of third-party plugins redesigned to fit in with the rest of the elements.
Material Dashboard makes use of light, surface and movement. The general layout resembles sheets of paper following multiple different layers, so that the depth and order is obvious. The navigation stays mainly on the left sidebar and the content is on the right inside the main panel.
This product came as a result of users asking for a material dashboard after we released our successful Material Kit. We developed it based on your feedback and it is a powerful bootstrap admin dashboard, which allows you to build products like admin panels, content managements systems and CRMs.
Material Dashboard comes with 5 color filter choices for both the sidebar and the card headers (blue, green, orange, red and purple) and an option to have a background image on the sidebar.
Material Dashboard uses a framework built by our friend Federico - Bootstrap Material Design, who did an amazing job creating the backbone for the material effects, animations, ripples and transitions. Big thanks to his team for the effort and forward thinking they put into it.
Special thanks go to:
- Julio C. Ramos for yii2-material-dashboard,
- sanpyaelin for yii2-material-dashboard,
- Robert McIntosh for the notification system,
- Chartist for the wonderful charts,
- Creative Tim for the marvelous theme.
Installation
The preferred way to install this extension is through composer.
Either run
php composer require --prefer-dist ricar2ce/yii2-material-theme "*"
or add
"ricar2ce/yii2-material-theme": "*"
to the require section of your composer.json file.
Quick Start
Once the extension is installed, you can have a preview by reconfiguring the path mappings of the view component:
'components' => [ 'view' => [ 'theme' => [ 'pathMap' => [ '@app/views' => '@vendor/ricar2ce/yii2-material-theme/view' ], ], ], ],
Or in your layouts/main.php include followin code for use de assets
<?php /* @var $this \yii\web\View */ /* @var $content string */ /* use yii\dependencies */ //Register class if (class_exists('rce\material\Assets')) { rce\material\Assets::register($this); ?> } ?> <?php $this->beginPage() ?> <!DOCTYPE html>
Don't forget to remove
'yii\bootstrap\BootstrapAsset'and'yii\bootstrap\BootstrapPluginAsset'frombackend\asset\AppAsset(advence) orapp\asset\AppAsset(basic)
Customization
- Copy files from
vendor/ricar2ce/yii2-material-theme/view - Remove the custom
viewconfiguration from your application by entered the new path mappings, if you have made them before.
Web-font usage
This extension use the fallowing depend for the font icons usage:
- Nick Tsai yii2-fontawesome
- Andrey Izman yii2-material-design-icons
Config template
Default config.
[
'siteTitle' => 'Material Dashboard',
'sidebarColor' => 'rose', // "purple | azure | green | orange | danger | rose"
'sidebarBackgroundColor' => 'black', // "black | white"
'sidebarBackgroundImage' => 'template/material-dashboard/img/sidebar-1.jpg'
]
You can change it in config file.
'components' => [ 'assetManager' => [ 'bundles' => [ 'rce\material\Assets' => [ 'siteTitle' => 'Your Site Name', 'sidebarColor' => 'azure', 'sidebarBackgroundColor' => 'black', 'sidebarBackgroundImage' => 'img url' ], ], ], ],
or
using bundled assets
Yii::$container->set( Assets::className(), [ 'siteTitle' => 'Your Site Name', 'sidebarColor' => 'rose', 'sidebarBackgroundColor' => 'black', 'sidebarBackgroundImage' => 'img url' ] );
Sidebar menu - Widget Menu
$menu = RCEmenu::widget( [ 'items' => [ ['label' => 'Dashboard', 'icon' => 'dashboard', 'url' => ['/site/index']], [ 'label' => 'Multi Level Collapse', 'icon' => 'swap_vertical_circle', 'url' => '#', 'items' => [ ['label' => 'Level One', 'url' => '#',], [ 'label' => 'Level Two', 'icon' => 'swap_vertical_circle', 'url' => '#', 'items' => [ ['label' => 'Level Three', 'url' => '#',], ['label' => 'Level Three', 'url' => '#',], ], ], ], ], [ 'label' => 'Some tools', 'icon' => 'build', 'url' => '#', 'items' => [ ['label' => 'Gii', 'icon' => 'settings_input_composite', 'url' => ['/gii'],], ['label' => 'Debug', 'icon' => 'bug_report', 'url' => ['/debug'],], ], ], ], ] );
create menu.php in common\models(advence) or app\models(basic) if you configuring the path mappings of the view component
example:
<?php namespace common\models; use Yii; use rce\material\widgets\Menu as RCEmenu; class Menu { static function getMenu() { $menu = RCEmenu::widget( [ 'items' => [ ['label' => 'Dashboard', 'icon' => 'dashboard', 'url' => ['/site/index']], [ 'label' => 'Multi Level Collapse', 'icon' => 'swap_vertical_circle', 'url' => '#', 'items' => [ ['label' => 'Level One', 'url' => '#',], [ 'label' => 'Level Two', 'icon' => 'swap_vertical_circle', 'url' => '#', 'items' => [ ['label' => 'Level Three', 'url' => '#',], ['label' => 'Level Three', 'url' => '#',], ], ], ], ], [ 'label' => 'Some tools', 'icon' => 'build', 'url' => '#', 'items' => [ ['label' => 'Gii', 'icon' => 'settings_input_composite', 'url' => ['/gii'],], ['label' => 'Debug', 'icon' => 'bug_report', 'url' => ['/debug'],], ], ], ], ] ); return $menu; } }
By default to icons will be added prefix of Material Icon
Notification : Noti widget
This is the Noti widget and Yii 2 enhanced wrapper for the Bootstrap Notify plugin
Usage
Add widget to your layout/main :
use rce\material\widgets\Noti; <?= Noti::widget(); ?>
Noti widget renders a message from session flash. All flash messages are displayed in the sequence they were assigned using setFlash. You can set message as following:
Set the message in your action, for example:
Yii::$app->session->setFlash('success', 'This is the success'); Yii::$app->session->setFlash('info', 'Your info'); Yii::$app->session->setFlash('warning', 'Your warning'); Yii::$app->session->setFlash('error', 'Your error');
Also, you can set multiple messages as follows:
Yii::$app->session->setFlash('info', ['message 1', 'message 2']);
Render message without the session flash
<?= rce\material\widgets\Noti::widget([ 'useSessionFlash' => false, 'options' => [ 'message' => 'Your message', ], 'clientOptions' => [ 'type' => 'info', // "error | warning | info | success | danger " ] ]); ?>
===============
TO DO
- [widgets] add more widgets for material template.
License
- Copyright 2017 Creative Tim
- Licensed under MIT
ricar2ce/yii2-material-theme 适用场景与选型建议
ricar2ce/yii2-material-theme 是一款 基于 SCSS 开发的 Composer 扩展包,目前已累计 5.88k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2019 年 06 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「theme」 「extension」 「yii2」 「creative」 「material」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ricar2ce/yii2-material-theme 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ricar2ce/yii2-material-theme 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ricar2ce/yii2-material-theme 相关的其它包
同方向 / 同关键字的高下载量 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
A Bootstrap 4.x base theme for SilverStripe
统计信息
- 总下载量: 5.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-11