承接 koolreport/yii2 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

koolreport/yii2

最新稳定版本:1.0.0

Composer 安装命令:

composer require koolreport/yii2

包简介

Ease report setup within Yii2 environment

README 文档

README

koolreport/yii2 package helps to ease the KoolReport report created within Yii2 environment. It can help to automatically configure assets path and url. Furthermore, it provide default datasource configured with Yii2 database connection.

Installation

By downloading .zip file

  1. Download
  2. Unzip the zip file
  3. Copy the folder yii2 into koolreport folder so that look like below
koolreport
├── core
├── yii2

By composer

composer require koolreport/yii2

Documentation

Step-by-step tutorial

Step 1: Create report and claim friendship with Laravel

  1. First, you create folder reports inside root folder
  2. Inside reports folder, create two files MyReport.php and MyReport.view.php
  3. Adding use \koolreport\yii2\Friendship to your report like following

MyReport.php

<?php
namespace app\reports;

class MyReport extends \koolreport\KoolReport
{
    use \koolreport\yii2\Friendship;
    // By adding above statement, you have claim the friendship between two frameworks
    // As a result, this report will be able to accessed all databases of Yii2
    // There are no need to define the settings() function anymore
    // while you can do so if you have other datasources rather than those
    // defined in Laravel.
    

    function setup()
    {
        $this->src("default")
        ->query("SELECT * FROM offices")
        ->pipe($this->dataStore("offices"));        
    }
}

MyReport.view.php

<?php
use \koolreport\widgets\koolphp\Table;
?>
<html>
    <head>
    <title>My Report</title>
    </head>
    <body>
        <h1>It works</h1>
        <?php
        Table::create([
            "dataSource"=>$this->dataStore("offices")
        ]);
        ?>
    </body>
</html>

Step 2: Run report and display report

Now you have MyReport ready, in order to get report display inside Yii2, you will create MyReport's object in controller and pass that object to the view to render.

HomeController.php

<?php

namespace app\controllers;

use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\Response;
use yii\filters\VerbFilter;
use app\models\LoginForm;
use app\models\ContactForm;

class SiteController extends Controller
{
    ...
    public function actionReport()
    {
        $report = new \app\reports\MyReport;
        $report->run();
        return $this->render('report',array(
            "report"=>$report
        ));
        
    }
}

report.php

<?php $report->render(); ?>

Support

Please use our forum if you need support, by this way other people can benefit as well. If the support request need privacy, you may send email to us at support@koolreport.com.

统计信息

  • 总下载量: 138.75k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-17