samlorlah / accounts
A Laravel package for managing financial accounts in banking-related applications
Requires
- php: ^8.1
- illuminate/console: ^10.0|^11.0|^12.0
- illuminate/database: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0|^11.0
This package is auto-updated.
Last update: 2026-04-07 21:49:28 UTC
README
A Laravel package for managing financial accounts in banking-related applications.
Provides double-entry bookkeeping, general ledger management, transaction tracking, account liens/freezes, daily balance snapshots, and an end-of-day (EOD) reconciliation command.
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
Installation
1. Install via Composer:
composer require samlorlah/accounts
Laravel's auto-discovery will automatically register the service provider.
2. Publish the config file:
php artisan vendor:publish --provider="Six3\Accounts\AccountServiceProvider" --tag=config
3. Publish and run the migrations:
php artisan vendor:publish --provider="Six3\Accounts\AccountServiceProvider" --tag=migrations
php artisan migrate
4. (Optional) Publish the seeders:
php artisan vendor:publish --provider="Six3\Accounts\AccountServiceProvider" --tag=seeders
Configuration
Edit config/accounts.php to suit your application.
Usage
The package binds AccountingServiceInterface in the service container. Resolve it via dependency injection or directly from the container.
Dependency Injection
use Six3\Accounts\Contracts\AccountingServiceInterface; class PaymentService { public function __construct(private AccountingServiceInterface $accounts) {} public function handle(): void { // Open a new account $account = $this->accounts->openAccount( account_type_code: 'SAV', customer_id: 1, account_name: 'John Doe Savings' ); // Post a double-entry transaction (debit and credit sides must balance) $result = $this->accounts->postTransaction([ 'post_status' => 'entered', // or 'approved' to auto-approve 'narration' => 'Initial deposit', 'value_date' => '2026-04-07', 'debit' => [ ['account_no' => '1000000001', 'amount' => '5000.00', 'force_debit' => false], ], 'credit' => [ ['account_no' => '1000000002', 'amount' => '5000.00'], ], ]); // Approve a pending transaction $this->accounts->approveTransaction(tranId: 'OXG_ABC123'); // Cancel a transaction $this->accounts->cancelTransaction(tranId: 'OXG_ABC123', comment: 'Duplicate entry'); // Get account balance $balance = $this->accounts->getAccountBalance(account_no: '1000000001'); // Validate an account number $validation = $this->accounts->validateAccount(account_no: '1000000001'); // Account enquiry / mini-statement $statement = $this->accounts->accountEnquiry( account_no: '1000000001', start_date: '2026-01-01', end_date: '2026-04-07' ); // Transaction journal for a date range $journal = $this->accounts->transactionJournal( start_date: '2026-01-01', end_date: '2026-04-07', status: 'approved' // 'all', 'entered', 'approved', 'cancelled' ); } }
Resolving from the Container
use Six3\Accounts\Contracts\AccountingServiceInterface; $accounts = app(AccountingServiceInterface::class); $balance = $accounts->getAccountBalance('1000000001');
Liens & Freezes
$accounts = app(AccountingServiceInterface::class); // Place a lien (hold) on an account $accounts->addLien( account_no: '1000000001', amount: 1000.00, comment: 'Pending court order', expiry_date: '2026-12-31' ); // List all liens on an account $accounts->listLien(account_no: '1000000001'); // Remove a lien by its ID $accounts->removeLien(lien_id: 3); // Freeze / unfreeze debit or credit on an account $accounts->updateFreeze( account_number: '1000000001', debit_freeze: true, credit_freeze: false, comment: 'Suspicious activity' ); // Fetch current freeze status $accounts->fetchFreeze(account_number: '1000000001');
Reports
$accounts = app(AccountingServiceInterface::class); $accounts->incomeStatement(date: '2026-04-07'); $accounts->balanceSheetByCategory(date: '2026-04-07'); $accounts->trialBalanceReport(date: '2026-04-07'); $accounts->chartOfAccount(); $accounts->checkEodStatus(date: '2026-04-06');
Artisan Commands
| Command | Description |
|---|---|
php artisan accounts:run-eod |
Run end-of-day processing and balance snapshots |
Models
Account— Core financial accountTransaction— Debit/credit entriesGeneralLedger— GL entriesGlSubCategory— GL sub-categoriesDailyAccountBalance— Daily balance snapshotsAccountLien— Lien (hold) records on an accountAccountFreeze— Account freeze recordsAccountSnapshot— Full account state snapshots
License
MIT — see LICENSE.