vitexsoftware/digest-modules
Composer 安装命令:
composer require vitexsoftware/digest-modules
包简介
System-agnostic data collection modules for accounting digest reports, Zabbix monitoring, and analytics
README 文档
README
System-agnostic data collection modules for accounting digest reports
A standalone PHP library providing analytics modules that work with any accounting system through a neutral DataProviderInterface. Modules return structured arrays — no HTML, no rendering, no system-specific code.
Overview
DigestModules is the analytics engine that:
- Defines a neutral vocabulary (
FILTER_*,FIELD_*,ENTITY_*constants) for conditions and return fields - Provides ready-made modules: invoices, payments, debtors, customers, products, reminders
- Stays completely decoupled from AbraFlexi, Pohoda, or any specific accounting system
- Returns structured data ready for rendering or further processing
Data providers (e.g. AbraFlexiDataProvider in vitexsoftware/abraflexi-digest) implement the interface and translate the neutral schema to system-specific queries.
Installation
composer require vitexsoftware/digest-modules
Quick Start
<?php use VitexSoftware\DigestModules\Core\ModuleRunner; use VitexSoftware\DigestModules\Modules\Debtors; use VitexSoftware\DigestModules\Modules\OutcomingInvoices; // Use any DataProviderInterface implementation (e.g. AbraFlexiDataProvider) $provider = new \AbraFlexi\Digest\Providers\AbraFlexiDataProvider($config); $runner = new ModuleRunner($provider); $runner->addModule('outcoming_invoices', new OutcomingInvoices()); $runner->addModule('debtors', new Debtors()); $period = new \DatePeriod( new \DateTime('first day of last month'), new \DateInterval('P1M'), new \DateTime('first day of this month'), ); $result = $runner->run($period); echo json_encode($result, JSON_PRETTY_PRINT);
Available Modules
| Module class | Key | Description |
|---|---|---|
OutcomingInvoices |
outcoming_invoices |
Issued invoices in the period |
IncomingInvoices |
incoming_invoices |
Received invoices in the period |
IncomingPayments |
incoming_payments |
Bank receipts in the period |
OutcomingPayments |
outcoming_payments |
Bank outflows in the period |
Debtors |
debtors |
All overdue unpaid receivables |
UnmatchedInvoices |
unmatched_invoices |
Issued invoices not matched to a payment |
UnmatchedPayments |
unmatched_payments |
Bank movements not matched to an invoice |
WaitingIncome |
waiting_income |
Proforma invoices awaiting settlement |
WaitingPayments |
waiting_payments |
Invoices awaiting payment |
NewCustomers |
new_customers |
Contacts created in the period |
Reminds |
reminds |
Invoices with pending payment reminders |
BestSellers |
best_sellers |
Top products/services sold in the period |
WithoutEmail |
without_email |
Contacts missing an email address |
WithoutTel |
without_tel |
Contacts missing a phone number |
AllTime\PurchasePriceLowerThanSales |
purchase_price_lower_than_sales |
Products sold below purchase price |
Module Output Format
Every module returns an array from AbstractModule::createResult():
[
'module_name' => 'outcoming_invoices',
'heading' => 'Outcoming Invoices',
'description' => '...',
'period' => [
'start' => '2024-01-01',
'end' => '2024-02-01',
],
'success' => true,
'data' => [/* module-specific */],
'metadata' => [
'timestamp' => '2024-01-15T10:30:00+01:00',
'provider' => 'abraflexi',
],
]
Data Providers
This package defines only the interface. Concrete providers live in their own packages:
| Provider | Package |
|---|---|
AbraFlexiDataProvider |
vitexsoftware/abraflexi-digest |
PohodaDataProvider |
vitexsoftware/pohoda-digest (planned) |
Extending
Create a custom module
<?php declare(strict_types=1); namespace YourApp\Analytics; use VitexSoftware\DigestModules\Core\AbstractModule; use VitexSoftware\DigestModules\Core\DataProviderInterface; class PaidThisWeek extends AbstractModule { protected string $moduleName = 'paid_this_week'; protected string $heading = 'Paid This Week'; public function process(DataProviderInterface $provider, \DatePeriod $period): array { $invoices = $provider->getData( DataProviderInterface::ENTITY_OUTCOMING_INVOICES, [ DataProviderInterface::FILTER_DATE_PERIOD => [ 'column' => DataProviderInterface::DATE_COLUMN_ISSUE_DATE, 'period' => $period, ], DataProviderInterface::FILTER_PAYMENT_STATUS => DataProviderInterface::PAYMENT_STATUS_PAID, DataProviderInterface::FILTER_CANCELLED => false, DataProviderInterface::FILTER_LIMIT => 0, ], ); $total = array_sum(array_column($invoices, DataProviderInterface::FIELD_TOTAL_AMOUNT)); return $this->createResult($period, true, [ 'summary' => [ 'count' => count($invoices), 'total_amount' => $this->formatCurrency($total), ], ]); } }
Create a custom data provider
Implement DataProviderInterface::getData() — translate neutral FILTER_* conditions to system-specific queries, and return records keyed with FIELD_* constants:
<?php declare(strict_types=1); use VitexSoftware\DigestModules\Core\DataProviderInterface; class MySystemDataProvider implements DataProviderInterface { public function getData(string $entity, array $conditions = [], array $columns = []): array { // 1. Map ENTITY_* → your system's endpoint // 2. Map FILTER_* conditions → your query format // 3. Return records with FIELD_* keys return array_map(fn($raw) => [ DataProviderInterface::FIELD_CODE => $raw['number'], DataProviderInterface::FIELD_COMPANY => $raw['client_name'], DataProviderInterface::FIELD_TOTAL_AMOUNT => (float) $raw['total'], DataProviderInterface::FIELD_CURRENCY => $raw['currency'] ?? 'CZK', DataProviderInterface::FIELD_CANCELLED => (bool) $raw['cancelled'], // ... other FIELD_* constants ], $this->fetchFromMySystem($entity, $conditions)); } public function getSystemName(): string { return 'my_system'; } // ... implement remaining interface methods }
License
MIT
vitexsoftware/digest-modules 适用场景与选型建议
vitexsoftware/digest-modules 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 11 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「data」 「analytics」 「modules」 「digest」 「zabbix」 「Accounting」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vitexsoftware/digest-modules 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vitexsoftware/digest-modules 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vitexsoftware/digest-modules 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This is Paymorrow module for OXID eShop.
Shoot aims to make providing data to your templates more manageable
Adds the EDTF data type to Wikibase
A simple library that allows transform any kind of data to native php data or whatever
Analysis module for finding problematical shop data.
yii2 swiper slider
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-09