agoalofalife/reports
Composer 安装命令:
composer require agoalofalife/reports
包简介
UI for created and download reports in Laravel
README 文档
README
Requirements : PHP verison >= 7.1.0 Laravel version >= 5.5
not support Laravel version 5.8 & >
What is it?
This is package offers ready UI and some code, for reports.
Reports will be with extensions: pdf, xlxs, xls, csv .
In the paradigm Laravel, we make reprots and write code. It's just!
Install
composer require agoalofalife/reports
php artisan reports:install
Locale
In file config/app.php select your language.
The package provides two languages:
- ru
- en
Blade and UI
In your template, you need to paste the code
<body>
@include('reports::app')
...
Cron
You have to add cron, how separete process.
// App\Console\Kernel use agoalofalife\Reports\Console\ParseReportsCommand; $schedule->command(ParseReportsCommand::class)->everyMinute();
The development process
You create new file report:
php artisan make:report NameReport
Insert in config config/reports.php :
'reports' => [ \App\Reports\TestReport::class ],
Fill the class:
<?php declare(strict_types=1); namespace App\Reports; use agoalofalife\Reports\Contracts\HandlerReport; use agoalofalife\Reports\Report; class TestReport extends Report implements HandlerReport { /** * Disk for filesystem * @var string */ public $disk = 'public'; /** * Format export : xls, xlsx, pdf, csv * @var string */ public $extension = 'xlsx'; /** * Get file name * @return string */ public function getFilename() : string { return 'TestReport'; } /** * Get title report * @return string */ public function getTitle() : string { return 'Test'; } /** * Get description report * @return string */ public function getDescription() : string { return 'Description test report'; } /** * @param $excel * @return bool */ public function handler($excel) : bool { $excel->sheet('Sheetname', function ($sheet) { $sheet->rows(array( array('test1', 'test2'), array('test3', 'test4') )); }); return true; } }
Property $disk, name disk in filesystem.
Property $extension, type extension your file.
Method getFilename accordingly return name file.
Method getTitle return name title in UI.
Method getDescription return description in UI.
Method handler is base method. Package use external package.
Method is a small wrapper.
Notification
Once the report is ready, you can send notification.
For this you need to implement interface agoalofalife\Reports\Contracts\NotificationReport.
Method getNotifiable return notifiable, which has a method routeNotificationFor.
And method getNotification, return Notification type.
// implements agoalofalife\Reports\Contracts\NotificationReport public function getNotifiable() { return User::where('email', 'test@gmail.com')->get()->first(); } public function getNotification(): Notification { return new InvoicePaid(); }
// app/User.php public function routeNotificationForSlack($notification) { return 'hook'; }
agoalofalife/reports 适用场景与选型建议
agoalofalife/reports 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.73k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2018 年 03 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「reports」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 agoalofalife/reports 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 agoalofalife/reports 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 agoalofalife/reports 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Export Craft data as CSVs in a snap
Library for easily converting reports into various HTTP responses
The Reportico Reporting Designer and Framework.
Alfabank REST API integration
Blade components to build PDF reports.
Export sprout forms to CSV (Excel supported)
统计信息
- 总下载量: 1.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 16
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-12
