fazzinipierluigi/laraccoon_datasource
Composer 安装命令:
composer require fazzinipierluigi/laraccoon_datasource
包简介
A Laravel library that processes server-side requests from the Raccoon Tables JavaScript plugin and returns the expected response format
README 文档
README
Laravel library that processes server-side requests from the Raccoon Tables JavaScript plugin and returns the expected response format.
Supports Laravel 9, 10, 11, 12, and 13.
Features
- Filtering (all Raccoon Tables operators)
- Sorting (multi-sort)
- Pagination (
start/limit) - Global search
- Row grouping with counts and optional aggregations
Installation
composer require fazzinipierluigi/laraccoon_datasource
Basic usage
use Fazzinipierluigi\LaraccoonDatasource\EloquentSource; public function index(Request $request) { $users = \App\Models\User::where('is_admin', 0); $source = new EloquentSource(); $source->apply($users, $request); return $source->getResponse(); }
Method signature
$source->apply( $data_set, // Eloquent\Builder or Query\Builder $request, // Illuminate\Http\Request $field_map, // optional — maps client field index → DB column(s) $search_fields, // optional — field indexes included in globalSearch $aggregations // optional — ['fieldIndex' => 'sum|avg|min|max|count'] for group agValues );
Field map
Maps the client-side index to one or more DB columns. Useful when the client field name differs from the DB column, or when one grid column maps to multiple DB columns (ORed together for filters).
$field_map = [ 'fiscal_reference' => ['users.tax_code', 'users.vat'], // OR match on both columns 'creation_date' => 'created_at', ]; $source->apply($users, $request, $field_map);
Global search
Pass an array of field indexes to search when the globalSearch / search parameter is present. Each field is resolved through $field_map to its DB column(s) and ORed together.
$source->apply($users, $request, $field_map, ['name', 'email', 'fiscal_reference']);
Custom row transform
return $source->getResponse(function ($row) { return [ 'username' => $row->username, 'fiscal_reference' => $row->is_company ? $row->vat : $row->tax_code, 'creation_date' => $row->created_at->format('d/m/Y'), ]; });
Group aggregations
When rowGroups is active the response includes a groups map. Pass $aggregations to have the server compute per-group sums/averages.
$source->apply($employees, $request, $field_map, null, [ 'salary' => 'sum', 'bonus' => 'sum', 'age' => 'avg', ]);
Response:
{
"data": [...],
"total": 284,
"groups": {
"Engineering": { "amount": 142, "agValues": { "salary": 9230000, "bonus": 1420000, "age": 34.2 } },
"Marketing": { "amount": 87, "agValues": { "salary": 4350000, "bonus": 522000, "age": 31.7 } }
}
}
Supported filter operators
sign |
Behavior |
|---|---|
= |
Contains (LIKE %value%) |
!= |
Not contains |
== |
Equals exact |
!== |
Not equals |
> |
Greater than |
< |
Less than |
a_ |
Starts with |
_a |
Ends with |
regex |
REGEXP (MySQL/MariaDB) |
empty |
IS NULL or empty string |
!empty |
IS NOT NULL and not empty string |
+ |
Numeric >= 0 |
- |
Numeric < 0 |
in |
whereIn (value must be an array) |
T |
Boolean true |
F |
Boolean false or NULL |
fazzinipierluigi/laraccoon_datasource 适用场景与选型建议
fazzinipierluigi/laraccoon_datasource 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 06 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「library」 「datagrid」 「laravel」 「datasource」 「eloquent」 「raccoon」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fazzinipierluigi/laraccoon_datasource 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fazzinipierluigi/laraccoon_datasource 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fazzinipierluigi/laraccoon_datasource 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
FSi DataIndexer Component - Component created to provide one simple object indexing strategy for FSi DataSource and DataGrid components.
FSi DataGrid Component
Symfony DataGridBundle
A laravel package for using datagrids.
Inbox pattern process implementation for your Laravel Applications
Provides a Data Grid tables for your Symfony project.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-11