r/dev • u/premod_suraweera • 12d ago
I built an open-source Double-Entry Accounting Engine for Laravel (nml/fincore)
Hey everyone!
Building ERP, POS, or SaaS applications often comes with a complex requirement: implementing compliant double-entry accounting. Handling strict debit/credit equality, immutable ledgers, period closing locks, and financial statements can quickly turn into a headache.
I built and open-sourced NML FinCore — a production-ready double-entry accounting engine for Laravel.
GitHub Repository: https://github.com/Premod1/nml-fincore
Key Features:
Strict Double-Entry Enforcement: Guaranteed
Sum(Debits) === Sum(Credits)with configurable rounding tolerance.Immutable Ledger & Audit Trail: Posted journal vouchers cannot be edited or deleted (for audit compliance). Changes must go through reversals or voiding.
Live Financial Statements: Real-time generation of Trial Balance, Balance Sheet (Assets = Liabilities + Equity), Profit & Loss (P&L), and General Ledger.
Multi-Currency Support: Functional currency reporting with live exchange rate conversions.
Fiscal Period & Year-End Closing: Lock closed fiscal months/years to prevent back-dated posting, with automated retained earnings roll-up.
Fixed Asset & Depreciation: Automated straight-line and reducing-balance depreciation calculations.
💻 Quick Example:
phpuse Nml\FinCore\Facades\FinCore;
$entry = FinCore::createJournalEntry([
'date' => now(),
'reference' => 'INV-10024',
'type' => 'general',
'description' => 'Customer Invoice Payment',
'lines' => [
['account_id' => $bankAccountId, 'type' => 'debit', 'amount' => 1500.00],
['account_id' => $arAccountId, 'type' => 'credit', 'amount' => 1500.00],
],
]);
// Post and commit to general ledger
$entry->post();The package is MIT licensed and supports Laravel 10 and 11 on PHP 8.1+.
I'd really appreciate your feedback, thoughts on the schema/design, or feature suggestions. If you find it useful, a star on GitHub would mean a lot!