承接 nisalatp/dynamicreportgenerator 相关项目开发

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

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

nisalatp/dynamicreportgenerator

Composer 安装命令:

composer require nisalatp/dynamicreportgenerator

包简介

Metadata-centric dynamic reporting engine with virtual attributes

README 文档

README

Laravel PHP License

Hi there! 👋 Welcome to the Dynamic Report Generator.

If you're a Laravel developer, you've probably been here before: you build a beautiful dashboard, hand it over to the client, and immediately get hit with a flood of requests. "Can we add a column for the user's last order date? What about filtering by customers who spent over $500 but haven't logged in recently?"

Before you know it, you're writing endless LEFT JOIN statements and creating custom controllers for every single report request. It's a massive bottleneck.

I built this package to solve that exact problem. It's a reporting engine that lets your non-technical users build their own complex reports on the fly, safely, without you having to write a single query for them.

✨ Why You'll Love It

  • No More Manual Joins: Ever tried to dynamically join 5 different tables based on user input? It's a nightmare. This package uses a Graph-Theory Breadth-First Search (BFS) to look at your Eloquent relationships and automatically find the shortest, most efficient path between models.
  • Virtual Attributes (The Secret Sauce): You can pre-write complex, heavy SQL subqueries (like calculating a user's total lifetime value) and register them as a "Virtual Attribute". To your end-users, it just looks like another simple column they can select.
  • Insanely Fast & Memory Efficient: We don't pull thousands of Eloquent models into PHP memory just to count them. The engine compiles the user's report request and pushes all the heavy lifting down to the database, where it belongs.
  • 100% UI Agnostic: It doesn't care if you use Vue, React, Livewire, or AlpineJS. You just send it a JSON payload, and it spits back optimized data.

📦 Installation

Pull it in via Composer:

composer require nisalatp/dynamicreportgenerator

(Note: If you're running this on a fresh install, you might need to allow minimum stability in your composer.json during development).

🚀 Quick Start

Using the package is super straightforward. Your frontend sends a JSON payload of what the user wants to see, and you pass it to the DynamicReport facade.

1. Generating a Report

use DynamicReport;
use Nisalatp\DynamicReportGenerator\Types\ReportRequest;

// 1. Catch the JSON payload from your frontend UI
$ast = new ReportRequest(
    baseModel: 'User',
    targetModels: ['Order', 'Address'], // The engine figures out the joins for you!
    selectedAttributes: [ /* columns the user wants */ ],
    innerFilters: /* filters the user applied */
);

// 2. Generate the optimized Laravel Query
$query = DynamicReport::generate($ast);

// 3. Return the data
return response()->json($query->paginate(50));

2. Setting Up Virtual Attributes

Want to give your users the ability to query "Total Spend" without exposing your complex database structure? Register a Virtual Attribute. You can do this in a Service Provider or an Admin Controller.

use Nisalatp\DynamicReportGenerator\Builders\VirtualAttributeBuilder;

VirtualAttributeBuilder::create('Total Spend')
    ->forBaseModel('User')
    ->withSqlFragment('(SELECT SUM(amount) FROM orders WHERE orders.user_id = users.id)')
    ->register();

Now, when a user clicks the "Total Spend" checkbox on your frontend, the engine injects that raw SQL safely into the query. It's like magic.

🤝 Want to Contribute?

This project is totally free and open-source. If you want to help make it better—whether that's adding NoSQL support, optimizing the graph traversal, or just fixing a typo—I'd love your help! Just fork the repo, make your changes, and open a pull request.

📄 License

This package is open-sourced software licensed under the MIT license. Enjoy building awesome things!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固