hickr/laravel-accounting

Laravel Accounting App

dev-main 2025-07-23 00:44 UTC

This package is auto-updated.

Last update: 2025-09-23 00:58:58 UTC


README

A modular, multi-tenant, multi-currency accounting engine for Laravel 12+, supporting IFRS-compliant reports and regional extensions (e.g., MIRA Maldives).

โœจ Features

  • ๐Ÿ“š Double-entry accounting (Journal, Ledger, COA)
  • ๐Ÿงพ IFRS-compliant financial reports:
    • Trial Balance
    • Profit & Loss
    • Balance Sheet
    • General Ledger
  • ๐ŸŒ Multi-currency support with exchange rates and inverse logic
  • ๐Ÿข Multi-tenancy (per business/entity)
  • ๐ŸŒ Modular regional compliance (e.g., MIRA 201 via plugin)
  • โœ… Pest/PHPUnit test coverage
  • ๐Ÿงฑ Clean architecture & Laravel Action-based design
  • ๐Ÿ› ๏ธ Configurable tenant model and table names

โš™๏ธ Installation

composer require hickr/laravel-accounting

Publish Config & Migrations

php artisan vendor:publish --tag=accounting-config
php artisan vendor:publish --tag=accounting-migrations

๐Ÿš€ Usage Examples

Post a Journal Entry

PostJournalEntryAction::execute([
    'tenant_id' => 1,
    'date' => '2025-01-01',
    'description' => 'Initial capital',
    'currency_code' => 'MVR',
    'exchange_rate' => 1,
    'lines' => [
        ['account_id' => 1, 'type' => 'debit', 'amount' => 1000],
        ['account_id' => 2, 'type' => 'credit', 'amount' => 1000],
    ],
]);

๐Ÿงพ Tax Invoice Entry Example

PostJournalEntryAction::execute([
    'tenant_id' => 1,
    'date' => '2025-07-15',
    'description' => 'MIRA GST Sale',
    'currency_code' => 'MVR',
    'exchange_rate' => 1,
    'lines' => [
        [
            'account_id' => 1, // Cash
            'type' => 'debit',
            'amount' => 1060,
            'base_currency_amount' => 1060,
        ],
        [
            'account_id' => 2, // Revenue
            'type' => 'credit',
            'amount' => 1000,
            'base_currency_amount' => 1000,
            'meta' => [
                'gst_type' => 'standard-rated',
                'gst_rate' => 6,
                'net_amount' => 1000,
                'gst_amount' => 60,
                'invoice_number' => 'INV-1001',
                'customer_name' => 'Ali Hassan',
                'customer_tin' => '1010101GST001',
            ],
        ],
        [
            'account_id' => 3, // GST Payable
            'type' => 'credit',
            'amount' => 60,
            'base_currency_amount' => 60,
        ],
    ]
]);

๐Ÿ—๏ธ Fixed Asset Management

  • Add and manage fixed assets via FixedAsset model.
  • Support for depreciation via:
    • Straight Line method
    • Reducing Balance method
  • Bulk depreciation processing supported per period.
  • Link each asset to an AssetCategory and account mapping.
use Hickr\Accounting\Models\FixedAsset;

$asset = FixedAsset::create([
    'tenant_id' => 1,
    'category_id' => 2,
    'name' => 'Dell Laptop',
    'purchase_date' => '2024-01-01',
    'cost' => 2000,
]);

๐Ÿงพ MIRA Compliance (Maldives)

  • Schedule 1 to Schedule 5 GST Reports implemented.
  • Income Tax Schedule 1, 2, and 4 supported.
  • meta field on journal_lines used for enhanced tagging.
  • Country-specific config under modules -> mira.
$config = config('accounting.modules.mira');
$rate = $config['gst']['standard_rate']; // 6%

๐Ÿ“ˆ Financial Statements

  • Profit & Loss
  • Balance Sheet
  • Trial Balance (grouped + flat)
  • Cash Flow Statement

๐Ÿ“Š Reports

Trial Balance

$data = TrialBalanceReportAction::run([
    'tenant_id' => 1,
    'date_from' => '2025-01-01',
    'date_to' => '2025-12-31',
    'group_by_type' => false,
]);

Profit & Loss

$data = ProfitAndLossReportAction::run([
    'tenant_id' => 1,
    'date_from' => '2025-01-01',
    'date_to' => '2025-12-31',
]);

Balance Sheet

$data = BalanceSheetReportAction::run([
    'tenant_id' => 1,
    'date_to' => '2025-12-31',
    'group_by_account' => true,
]);

General Ledger

$data = GeneralLedgerReportAction::run([
    'tenant_id' => 1,
    'date_from' => '2025-01-01',
    'date_to' => '2025-12-31',
]);

๐Ÿง  Advanced Configuration Notes

// config/accounting.php

'tenant_model' => App\Models\Tenant::class,

'tenant_table' => 'tenants',

'modules' => [
    'mira' => [
        'enabled' => true,
        'gst' => [
            'standard_rate' => 0.06,
            'zero_rate' => 0.0,
        ],
    ],
],

โœ… Testing

vendor/bin/pest
# or
vendor/bin/phpunit

Uses Orchestra Testbench to run package tests.

๐Ÿงฉ Regional Compliance

This package supports regional reporting plugins via config. For example:

// config/accounting.php
'region_module' => \Hickr\Accounting\MIRA\MiraModule::class,

MIRA reports (GST 201, Income Tax) can be developed as standalone modules.

๐Ÿงช Tests Included

  • Journal entries (balancing, currency conversion)
  • Trial balance (flat & grouped)
  • Profit & Loss
  • Balance Sheet
  • General Ledger

๐Ÿงฑ Architecture

  • Tenant-aware by config
  • Supports soft-deleted tenants
  • Region support via strategy pattern

๐Ÿ—‚๏ธ Roadmap

  • Trial Balance
  • Profit & Loss
  • Balance Sheet
  • General Ledger
  • Cash Flow Statement
  • MIRA 201, 401, Income Tax Schedules
  • Journal approvals / audit trail

๐Ÿงพ License

MIT License