gbxnga/laravel-ledger
Composer 安装命令:
composer require gbxnga/laravel-ledger
包简介
General Ledger and Journal Accounting Package for Laravel with JSON API
README 文档
README
General Ledger and Journal Accounting Package for Laravel with JSON API.
A maintained fork of abivia/ledger, upgraded to support modern PHP and Laravel versions.
Features
- Full double-entry accounting system with audit trail capability.
- Multi-currency support.
- Support for multiple business units.
- Sub-journal support.
- Multilingual.
- Integrates via direct controller access or through JSON API.
- Atomic transactions with concurrent update blocking.
- Reference system supports soft linking to other ERP components.
- Bulk journal detail inserts and aggregated balance updates for high-volume posting.
- Automatic batch coalescing — consecutive
entry/addandentry/deleteoperations in a batch are merged into bulk passes. - Configurable chunk sizes and optional performance metrics logging.
Requirements
- PHP 8.2+
- Laravel 11 or 12
Installation
composer require gbxnga/laravel-ledger
Publish configuration:
php artisan vendor:publish --provider="Abivia\Ledger\LedgerServiceProvider"
Create database tables:
php artisan migrate
Migrating from abivia/ledger
If you're currently using abivia/ledger, you can switch to this package with minimal effort. All PHP namespaces (Abivia\Ledger\*) remain unchanged, so your application code works as-is.
- Swap the package:
composer remove abivia/ledger composer require gbxnga/laravel-ledger
- Update your PHP and Laravel versions if needed:
- PHP 8.2+ (previously 8.0+)
- Laravel 11 or 12 (previously Laravel 8+)
Your published config (config/ledger.php), migrations, and database tables are not affected by the package swap. No changes are needed to your service provider references, config files, migrations, or any code that uses Abivia\Ledger classes.
Configuration
The configuration file is installed as config/ledger.php. You can enable/disable the JSON API, set middleware, and a path prefix to the API.
Performance Tuning
Journal detail inserts and balance updates are performed in bulk using chunked queries. When a batch contains consecutive entry/add or entry/delete operations, they are automatically coalesced into grouped passes — reducing database round-trips from O(n) per detail line to O(1) chunked operations.
All settings live under ledger.performance in config/ledger.php and can be overridden via environment variables:
| Environment Variable | Default | Description |
|---|---|---|
LEDGER_ENTRY_DETAIL_CHUNK |
1000 |
Max rows per journal_details bulk insert |
LEDGER_ENTRY_BALANCE_CHUNK |
500 |
Max rows per ledger_balances select/upsert pass |
LEDGER_ROOT_DETAIL_CHUNK |
1000 |
Max rows per opening-balance detail insert |
LEDGER_ROOT_BALANCE_CHUNK |
500 |
Max rows per opening-balance upsert |
LEDGER_BATCH_COALESCE_ENTRY_ADD |
true |
Merge consecutive entry/add batch operations into one bulk write |
LEDGER_BATCH_COALESCE_ENTRY_DELETE |
true |
Merge consecutive entry/delete batch operations into one bulk delete/reversal pass |
LEDGER_BATCH_COALESCE_MIN_GROUP |
2 |
Minimum consecutive add/delete operations required before coalescing activates |
LEDGER_PERFORMANCE_METRICS |
false |
Emit structured performance logs (detail rows, chunks, elapsed time) |
Updating
To ensure schema changes are in place, publish the configuration again and migrate:
php artisan vendor:publish --provider="Abivia\Ledger\LedgerServiceProvider"
php artisan migrate
Testing
composer test
With coverage:
composer test-coverage
Documentation
Full documentation is available at ledger.abivia.com.
Credits
- Alan Langford - Original author
- Gbenga Oni - Maintainer of this fork
License
MIT. See LICENSE for details.
gbxnga/laravel-ledger 适用场景与选型建议
gbxnga/laravel-ledger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.85k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「ledger」 「Accounting」 「journal」 「abivia」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 gbxnga/laravel-ledger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gbxnga/laravel-ledger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 gbxnga/laravel-ledger 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP SDK for Ledga.io - Programmatic double-entry ledgers for finance, gaming and multi-tenant SaaS
Access auditing middleware intended for use with Slim Framework applications
Accounting module for atmosphere and laravel
Library for working with monetary values, a BCMath library with rounding support.
ledger implementation for laravel
Alfabank REST API integration
统计信息
- 总下载量: 9.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-28