mohamedhekal / ledgercore
Double-entry ledger engine for Laravel ERP/fintech: balanced journals, immutable postings, balances, and period locks
v0.1.0
2026-07-16 14:23 UTC
Requires
- php: ^8.2
- illuminate/contracts: ^11.0|^12.0
- illuminate/database: ^11.0|^12.0
- illuminate/events: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- laravel/pint: ^1.18
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/phpstan: ^2.0
README
Search terms: laravel, accounting, ledger, double-entry, journal, erp, fintech, php, laravel-package, bookkeeping, general-ledger, accounting-engine.
Double-entry ledger engine for Laravel ERP/fintech apps: balanced journals, immutable postings, account balances, and fiscal period locks.
Amounts are integer minor units (cents). Single currency in v0.1.
Installation
composer require mohamedhekal/ledgercore php artisan vendor:publish --tag=ledgercore-config php artisan migrate
Chart + period
use Hekal\LedgerCore\Models\Account; use Hekal\LedgerCore\Models\FiscalPeriod; use Hekal\LedgerCore\Enums\AccountType; FiscalPeriod::create([ 'name' => '2026', 'starts_on' => '2026-01-01', 'ends_on' => '2026-12-31', ]); $cash = Account::create(['code' => '1000', 'name' => 'Cash', 'type' => AccountType::Asset]); $sales = Account::create(['code' => '4000', 'name' => 'Sales', 'type' => AccountType::Revenue]);
Post a journal
use Hekal\LedgerCore\Facades\Ledger; use Hekal\LedgerCore\Support\JournalLineDraft; $journal = Ledger::post('2026-03-15', [ new JournalLineDraft($cash->id, debit: 10_000), new JournalLineDraft($sales->id, credit: 10_000), ], memo: 'Cash sale'); Ledger::reverse($journal); $tb = Ledger::trialBalance(); // totals.balanced === true
Guarantees
- Unbalanced journals throw
- Lines must be debit XOR credit
- Closed periods reject posts
- Postings are append-only; corrections use reversing journals
- Account rows are
lockForUpdateduring post
Limitations (v0.1)
- No multi-currency / FX
- No cost-center dimensions
- No inventory valuation (see StockPulse)
- Trial balance lists raw debit/credit totals, not presentation-side nets
Testing
composer install && composer test
License
MIT