Yii2 Dashboard is a module that allows you to create and manage admin dashboards using custom layouts and panels.
Yii2-dashboard is designed to work out of the box, meaning that installation requires minimal steps. Only one configuration step should be taken and you are ready to have a dynamic dashboard on your Yii2 website.
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist esoftslimited/yii2-dashboard "*"
or add
"esoftslimited/yii2-dashboard": "*"
to the require section of your composer.json
file.
Add following lines to your main configuration file:
NOTE: Make sure that you don't have
dashboard
component ormodule
configuration in your config files. otherwise this step will override it
'modules' => [
'dashboard' => [
'class' => 'esoftslimited\dashboard\Module',
],
],
You have Yii2-dashboard installed. Now you can start adding panels on to your dashboard using this method
\Yii::$app->dashboard->addPanel($name,$view,$section);
The addPanel() function accepts 3 parameters
$name; /** name of the panel **/
$view; /** content of the panel **/
$section; /** section where the panel will be displayed**/
NOTE: You can add as many panel as you wish
The dashboard component allows custom layouts using the following function
\Yii::$app->dashboard->setLayout(String $layout);
On your admin/dashboad view invoke
\Yii::$app->dashboard->display;
to display your panels
On your dashboard view add the following
$layout='<div class="row"><div class="col-md-8">{stats}</div> <div class="col-md-4">{test2}</div></div></div>';
\Yii::$app->dashboard->setLayout($layout);
\Yii::$app->dashboard->addPanel('{stats}',$testView);
\Yii::$app->dashboard->addPanel('test2','<dic class="row">Example</div>');
//\Yii::$app->dashboard->addPanel('test3','View3','left');
\Yii::$app->dashboard->display;
The module is still on dev we are hoping to achieve a dynamic easy to use plugin
- Add module hooks,where modules will be able to 'inject' thier panels to the dashboard on-the-fly
- Allow using yii\widgets\Block on layouts
- Utilize cache for enhacing performace
- Add hooks for allowing draggable and saving user settings to the database
- Add many useful functions on dashboard component;
- Design default module for diplaying dashboard that is flexible and extensible
- Organize this ToDo in order of priority
- Relax and develop