Log*_*bby 5 php mysql reporting
我正在寻找一个基于Web的报告框架,该框架基于PHP并且可以与MySQL一起使用。
这是我的问题(除了懒得自己编写程序外):我有一个很大的表(50k +行),用于存储多个客户端的日志数据。这些客户需要能够排序和搜索并完成所有这些宏伟的事情。
我真的很想要拥有强大功能的东西,这就是为什么我对自己建造自己感到担忧。需要花费大量时间来满足这一需求还不够大,但这对我的客户来说是必需的功能。
理想情况下,我需要某种框架,既可以传递数据,也可以使用模板引擎获取数据本身(这样它将完成所有演示)。我可以获取呈现的演示文稿并将其放到我的网站中。
这样的好东西可能不存在,但也许我会很幸运。
您可以尝试使用KoolReport。
免责声明:我正在研究这个项目。
它是一个 PHP 报告框架,正是您所寻找的。您可以通过网站下载框架,从github克隆项目或使用composer安装:composer require koolphp/koolreport。
安装后,这是创建销售报告的基本示例
index.php:这是引导文件
<?php
require_once "SalesByCustomer.php";
$salesByCustomer = new SalesByCustomer;
$salesByCustomer->run()->render();
Run Code Online (Sandbox Code Playgroud)
SaleByCustomer.php:该文件定义了数据连接和数据处理
<?php
require_once "koolreport/autoload.php";
use \koolreport\processes\Group;
use \koolreport\processes\Limit;
use \koolreport\processes\Sort;
class SalesByCustomer extends \koolreport\KoolReport
{
public function settings()
{
return array(
"dataSources"=>array(
"sales"=>array(
"connectionString"=>"mysql:host=localhost;dbname=db_sales",
"username"=>"root",
"password"=>"",
"charset"=>"utf8"
)
)
);
}
public function setup()
{
$this->src('sales')
->query("SELECT customerName,dollar_sales FROM customer_product_dollarsales")
->pipe(new Group(array(
"by"=>"customerName",
"sum"=>"dollar_sales"
)))
->pipe(new Sort(array(
"dollar_sales"=>"desc"
)))
->pipe(new Limit(array(10)))
->pipe($this->dataStore('sales_by_customer'));
}
}
Run Code Online (Sandbox Code Playgroud)
SalesByCustomer.view.php:这是您可以在其中可视化数据的视图文件
<?php
use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\BarChart;
?>
<div class="text-center">
<h1>Sales Report</h1>
<h4>This report shows top 10 sales by customer</h4>
</div>
<hr/>
<?php
BarChart::create(array(
"dataStore"=>$this->dataStore('sales_by_customer'),
"width"=>"100%",
"height"=>"500px",
"columns"=>array(
"customerName"=>array(
"label"=>"Customer"
),
"dollar_sales"=>array(
"type"=>"number",
"label"=>"Amount",
"prefix"=>"$",
)
),
"options"=>array(
"title"=>"Sales By Customer"
)
));
?>
<?php
Table::create(array(
"dataStore"=>$this->dataStore('sales_by_customer'),
"columns"=>array(
"customerName"=>array(
"label"=>"Customer"
),
"dollar_sales"=>array(
"type"=>"number",
"label"=>"Amount",
"prefix"=>"$",
)
),
"cssClass"=>array(
"table"=>"table table-hover table-bordered"
)
));
?>
Run Code Online (Sandbox Code Playgroud)
这是结果。
基本上,您可以同时从许多数据源获取数据,通过流程传输它们,然后将结果存储到数据存储中。然后,数据存储中的数据将在视图中可用以实现可视化。Google Charts集成在框架内,因此您可以立即使用它来创建漂亮的图表和图表。
好吧,这里有一些很好的链接:
希望有帮助。
我找到了一个非常适合我的需求的不错的替代品:一个名为laiguExtGridPlugin的 Symfony 插件。它不是一个框架,但它使用 JSON 调用来获取数据并通过排序和分页来显示数据。我还没有真正实现它,今晚我将阅读源代码,看看如何实现——关于该插件的文档很少,请看一下。一旦我实现了它,我最终会在我的博客上发布一些内容。
更新: laiguExtGridPlugin 已经实现,但它位于名为ext的 Javascript 库之上。这个库很大,超过 27 兆。这是整个库的内容。我使用的部分大约是100KB。我也使用 jQuery,所以这两个库的加载(谢天谢地,它只适用于一页)是非常不可接受的。我将切换到基于 jQuery 的网格系统。
我还发现了 Trirand 提供的一个商业许可的 jQuery 插件,名为jqGrid。带有订阅、源和优先支持的单座许可证 599 美元,仅许可证 450 美元,这有点超出了我的价格范围。然而,它看起来确实相当不错,让我想起了较新的 Msoft Office UI。
目前,前者就可以了;但是,我将四处寻找一个框架。我可能自己做一个。
| 归档时间: |
|
| 查看次数: |
13688 次 |
| 最近记录: |