PHPackages                             ekmungai/eloquent-ifrs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. ekmungai/eloquent-ifrs

ActiveLibrary[Database &amp; ORM](/categories/database)

ekmungai/eloquent-ifrs
======================

Eloquent Double Entry Accounting with focus on IFRS Compliant Reporting

v5.0.4(1y ago)35757.9k↓38.1%87[4 PRs](https://github.com/ekmungai/eloquent-ifrs/pulls)MITPHPPHP ^8.1CI passing

Since Apr 19Pushed 2mo ago23 watchersCompare

[ Source](https://github.com/ekmungai/eloquent-ifrs)[ Packagist](https://packagist.org/packages/ekmungai/eloquent-ifrs)[ GitHub Sponsors](https://github.com/ekmungai)[ RSS](/packages/ekmungai-eloquent-ifrs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (35)Used By (0)

Eloquent IFRS
=============

[](#eloquent-ifrs)

[![Build Status](https://camo.githubusercontent.com/f01db72f7ee450824b669f3c2e045ac1a2a7af11fdf033ce66a197d2dcfbb0f1/68747470733a2f2f6170702e7472617669732d63692e636f6d2f656b6d756e6761692f656c6f7175656e742d696672732e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/ekmungai/eloquent-ifrs)[![Test Coverage](https://camo.githubusercontent.com/1d4af0a8b562c1f1b77bde6fceedca536807865138731e1c0ac70ca2bfee9ab3/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f37616661633132353364306636363264316366642f746573745f636f766572616765)](https://codeclimate.com/github/ekmungai/eloquent-ifrs/test_coverage)[![Maintainability](https://camo.githubusercontent.com/62187199bd40b37f806063f48b67832e6010fb4e1ea4e1ed553c881aec0a06a9/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f37616661633132353364306636363264316366642f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/ekmungai/eloquent-ifrs/maintainability)[![PHP 8.0](https://camo.githubusercontent.com/82887c22962d0022d20f61e17b76e949b7c813ca52cd0b00e794487a1a951169/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302d626c75652e737667)](https://camo.githubusercontent.com/82887c22962d0022d20f61e17b76e949b7c813ca52cd0b00e794487a1a951169/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302d626c75652e737667)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)[![Total Downloads](https://camo.githubusercontent.com/7f5daecf7d315ef3b107e65cb95e4de567ab6378a782674125f39a721c735159/68747470733a2f2f706f7365722e707567782e6f72672f656b6d756e6761692f656c6f7175656e742d696672732f646f776e6c6f616473)](//packagist.org/packages/ekmungai/eloquent-ifrs)[![Latest Stable Version](https://camo.githubusercontent.com/f4229899f4e4b02ca6893a3f5877030b177eda802f0817aeedf871c9e198089f/68747470733a2f2f706f7365722e707567782e6f72672f656b6d756e6761692f656c6f7175656e742d696672732f76)](//packagist.org/packages/ekmungai/eloquent-ifrs)

This Package enables any Laravel application to generate [International Financial Reporting Standards](https://www.ifrs.org/issued-standards/list-of-standards/conceptual-framework/) compatible Financial Statements by providing a fully featured and configurable Double Entry accounting subsystem.

The package supports multiple Entities (Companies), Account Categorization, Transaction assignment, Start of Year Opening Balances and accounting for VAT Transactions. Transactions are also protected against tampering via direct database changes ensuring the integrity of the Ledger. Outstanding amounts for clients and suppliers can also be displayed according to how long they have been outstanding using configurable time periods (Current, 31 - 60 days, 61 - 90 days etc). Finally, the package supports the automated posting of forex difference transactions both within the reporting period as well as translating foreign denominated account balances at a set closing rate.

This package is a community initiative of [microbooks.io](https://microbooks.io).

Table of contents
-----------------

[](#table-of-contents)

- [Eloquent IFRS](#eloquent-ifrs)
    - [Table of contents](#table-of-contents)
    - [Installation](#installation)
        - [For production](#for-production)
        - [For development](#for-development)
    - [Configuration](#configuration)
    - [Usage](#usage)
        - [DB Collision](#db-collision)
        - [Examples](#examples)
    - [Changelog](#changelog)
    - [Getting Involved](#getting-involved)
    - [Contributing](#contributing)
    - [Roadmap](#roadmap)
    - [License](#license)
    - [References](#references)

Installation
------------

[](#installation)

Use composer to Install the package into your laravel or lumen application. Eloquent IFRS requires PHP version 8.0.2 and Eloquent version 8 and above.

#### For production

[](#for-production)

```
composer require "ekmungai/eloquent-ifrs"
```

If using Lumen, make sure to register the package with your application by adding the `IFRSServiceProvider` to the `app.php` in the bootstrap folder.

```

```

Examples
--------

[](#examples)

This simple example covers the four scenarios to demonstrate the use of the package. First, a description of a Cash Sale to a customer, then a Credit Sale (Invoice) to a client, then a Cash Purchase for an operations expense and finally a Credit Purchase (Bill) from a Supplier for a non operations purpose (Asset Purchase).

First we'll setup the Company (Reporting Entity) and required Accounts to record the Transactions. (Assuming that a registered User already exists):

```
use IFRS\Models\Entity;
use IFRS\Models\Currency;

$entity = Entity::create([
    "name" => "Example Company",
]);

//Entities require a reporting currency
$currency = Currency::create([
    "name" => "Euro",
    "currency_code" => "EUR"
]);

// Set the currency as the Entity's Reporting Currency
$entity->currency_id = $currency->id;
$entity->save();
```

We also need the VAT Rates that apply to the Entity:

```
use IFRS\Models\Vat;

$outputVat = Vat::create([
    'name' => "Standard Output Vat",
    'code' => "O",
    'rate' => 20,
    'account_id' => Account::create([
        'name' => "Sales VAT Account",
        'account_type' => Account::CONTROL,
    ])
]);

$inputVat = Vat::create([
    'name' => "Standard Input Vat",
    'code' => "I",
    'rate' => 10,
    'account_id' =>  Account::create([
        'name' => "Input VAT Account",
        'account_type' => Account::CONTROL,
    ])
]);
```

Now we'll set up some Accounts:

```
use IFRS\Models\Account;

$bankAccount = Account::create([
    'name' => "Bank Account",
    'account_type' => Account::BANK,
]);

$revenueAccount = Account::create([
    'name' => "Sales Account",
    'account_type' => Account::OPERATING_REVENUE,
]);

$clientAccount = Account::create([
    'name' => "Example Client Account",
    'account_type' => Account::RECEIVABLE,
]);

$supplierAccount = Account::create([
    'name' => "Example Supplier Account",
    'account_type' => Account::PAYABLE,
]);

$opexAccount = Account::create([
    'name' => "Operations Expense Account",
    'account_type' => Account::OPERATING_EXPENSE,
]);

$assetAccount = Account::create([
    'name' => "Office Equipment Account",
    'account_type' => Account::NON_CURRENT_ASSET,
]);
```

Now we will create some Transactions in the Ledger, afterwards we will generate some reports. First though, it require a reporting period:

```
use IFRS\Models\ReportingPeriod;

$period = ReportingPeriod::create([
    'period_count' => 1,
    'calendar_year' => 2022,
]);
```

Now that all Accounts are prepared, we can create the first Transaction, a Cash Sale:

```
use IFRS\Transactions\CashSale;

$cashSale = CashSale::create([
    'account_id' => $bankAccount->id,
    'date' => Carbon::now(),
    'narration' => "Example Cash Sale",
]); // Intermediate save does not record the transaction in the Ledger
```

So far the Transaction has only one side of the double entry, so we create a Line Item for the other side:

```
use IFRS\models\LineItem;

$cashSaleLineItem = LineItem::create([
    'account_id' => $revenueAccount->id,
    'narration' => "Example Cash Sale Line Item",
    'quantity' => 1,
    'amount' => 100,
]);

$cashSaleLineItem->addVat($outputVat);
$cashSale->addLineItem($cashSaleLineItem);
$cashSale->post(); // This posts the Transaction to the Ledger
```

The rest of the transactions:

```
use IFRS\Transactions\ClientInvoice;

$clientInvoice = ClientInvoice::create([
    'account_id' => $clientAccount->id,
    'date' => Carbon::now(),
    'narration' => "Example Credit Sale",
]);

$clientInvoiceLineItem = LineItem::create([
    'account_id' => $revenueAccount->id,
    'narration' => "Example Credit Sale Line Item",
    'quantity' => 2,
    'amount' => 50,
]);

$clientInvoiceLineItem->addVat($outputVat);
$clientInvoice->addLineItem($clientInvoiceLineItem);

//Transaction save may be skipped as post() saves the Transaction automatically
$clientInvoice->post();

use IFRS\Transactions\CashPurchase;

$cashPurchase = CashPurchase::create([
    'account_id' => $clientAccount->id,
    'date' => Carbon::now(),
    'narration' => "Example Cash Purchase",
]);

$cashPurchaseLineItem = LineItem::create([
    'account_id' => $opexAccount->id,
    'narration' => "Example Cash Purchase Line Item",
    'quantity' => 4,
    'amount' => 25,
]);

$cashPurchaseLineItem->addVat($inputVat);
$cashPurchase->addLineItem($cashPurchaseLineItem);
$cashPurchase->post();

use IFRS\Transactions\SupplierBill;

$supplierBill = SupplierBill::create([
    'account_id' => $supplierAccount->id,
    'date' => Carbon::now(),
    'narration' => "Example Credit Purchase",
]);

$supplierBillLineItem = LineItem::create([
    'vat_id' => $inputVat->id,
    'account_id' => $assetAccount->id,
    'narration' => "Example Credit Purchase Line Item",
    'quantity' => 4,
    'amount' => 25,
]);

$supplierBillLineItem->addVat($inputVat);
$supplierBill->addLineItem($supplierBillLineItem);
$supplierBill->post();

use IFRS\Transactions\ClientReceipt;

$clientReceipt = ClientReceipt::create([
    'account_id' => $clientAccount->id,
    'date' => Carbon::now(),
    'narration' => "Example Client Payment",
]);

$clientReceiptLineItem = LineItem::create([
    'account_id' => $bankAccount->id,
    'narration' => "Part payment for Client Invoice",
    'quantity' => 1,
    'amount' => 50,
]);

$clientReceipt->addLineItem($clientReceiptLineItem);
$clientReceipt->post();
```

We can assign the receipt to partially clear the Invoice above:

```
use IFRS\Models\Assignment;

echo $clientInvoice->clearedAmount; //0: Currently the Invoice has not been cleared at all
echo $clientReceipt->balance; //50: The Receipt has not been assigned to clear any transaction

$assignment = Assignment::create([
    'assignment_date'=> Carbon::now(),
    'transaction_id' => $clientReceipt->id,
    'cleared_id' => $clientInvoice->id,
    'cleared_type'=> $clientInvoice->clearedType,
    'amount' => 50,
]);

echo $clientInvoice->clearedAmount; //50
echo $clientReceipt->balance; //0: The Receipt has been assigned fully to the Invoice
```

The Income Statement (Profit and Loss):

```
use IFRS\Reports\IncomeStatement;

$incomeStatement = new IncomeStatement(
    "2021-01-01",   // Report start date
    "2021-12-31",   // Report end date
)->getSections();// Fetch balances from the ledger and store them internally

/**
* this function is only for demonstration and
* debugging use and should never be called in production
*/
dd($incomeStatement->toString());

Example Company
Income Statement
For the Period: Jan 01 2021 to Dec 31 2021

Operating Revenues
    Operating Revenue        200 (100 cash sales + 100 credit sales)

Operating Expenses
    Operating Expense        100 (cash purchase)
                        ---------------
Operations Gross Profit      100

Non Operating Revenues
    Non Operating Revenue    0
                        ---------------
Total Revenue                100

Non Operating Expenses
    Direct Expense           0
    Overhead Expense         0
    Other Expense            0
                        ---------------
Total Expenses               0
                        ---------------
Net Profit                   100
                        ===============
```

The Balance Sheet:

```
use IFRS\Reports\BalanceSheet;

$balanceSheet = new BalanceSheet(
    "2021-12-31"  // Report end date
)->getSections();

/**
* again to emphasize, this function is only for demonstration and
* debugging use and should never be called in production
*/
dd($balanceSheet->toString());

Example Company
Balance Sheet
As at: Dec 31 2021

Assets
    Non Current Asset        120 (asset purchase)
    Receivables              70  (100 credit sale + 20 VAT - 50 client receipt)
    Bank                     50  (120 cash sale - 120 cash purchase + 50 client receipt)
                        ---------------
Total Assets                 240

Liabilities
    Control Account          20  (VAT: 20 cash sale + 20 credit sale - 10 cash purchase - 10 credit purchase)
    Payable                  120 (100 credit purchase + 20 VAT)
                        ---------------
Total Liabilities            140

                        ---------------
Net Assets                   100
                        ===============

Equity
    Income Statement         100
                        ---------------
Total Equity                 100
                        ===============
```

While the Income Statement and Balance Sheet are the ultimate goal for end year (IFRS) reporting, the package also provides intermediate period reports including Account Statement, which shows a chronological listing of all Transactions posted to an account ending with the current balance for the account; and Account Schedule, which is similar to an Account Statement with the difference that rather than list all Transactions that constitute the ending balance the report only shows the outstanding (Uncleared) Transactions.

In the above example:

```
use IFRS\Reports\AccountStatement;
use IFRS\Reports\AccountSchedule;

$transactions = new AccountStatement($clientAccount)->getTransactions();

dd($transactions);

array:2[
  ["transaction" => ClientInvoice, "debit" => 120, "credit" => 0, "balance" => 120],
  ["transaction" => ClientReceipt, "debit" => 0, "credit" => 50, "balance" => 70]
]

$transactions = new AccountSchedule($clientAccount, $currency)->getTransactions();

dd($transactions);

array:1[
  ["transaction" => ClientInvoice, "amount" => 120, "cleared" => 50, "balance" => 70],
]
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes.

Getting Involved
----------------

[](#getting-involved)

I am acutely aware that as a professionally trained Accountant I may have used some conventions, definitions and styles that while seemingly obvious to me, might not be so clear to another developer. I would therefore welcome and greatly appreciate any feedback on the ease of use of the package so I can make it more useful to as many people as possible.

Contributing
------------

[](#contributing)

1. Fork it
2. Create your feature branch (`git checkout -b feature/fooBar`)
3. Write tests for the feature
4. Commit your changes (`git commit -am 'Add some fooBar'`)
5. Push to the branch (`git push origin feature/fooBar`)
6. Create a new Pull Request

Roadmap
-------

[](#roadmap)

- Add Cashflow Statement
- Laravel 8 Compatibility
- Add Multicurrency support
- Expand Taxation Functionality

License
-------

[](#license)

This software is distributed for free under the MIT License

References
----------

[](#references)

- This package is heavily influenced by [chippyash/simple-accounts-3](https://github.com/chippyash/simple-accounts-3) and [scottlaurent/accounting](https://github.com/scottlaurent/accounting).
- Special thanks to [paschaldev](https://github.com/paschaldev) for his brilliant work in preventing collisions with already existing db tables.

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance67

Regular maintenance activity

Popularity51

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 69.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~85 days

Recently: every ~268 days

Total

22

Last Release

424d ago

Major Versions

1.1.1 → 2.0.02020-05-25

v2.0.1 → 3.0.02021-01-25

v3.1.4 → 4.0.02021-04-05

v4.2.1 → v5.0.02022-04-12

PHP version history (6 changes)1.0.0PHP ^7.2

1.0.1PHP ^7.2.5

v3.1.2PHP ^7.3.0

v4.2.0PHP ^7.3|^8.0

v5.0.0PHP ^8.0.2

v5.0.1PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/098e0bb1c7b018e61dfc95a341ce1c658894ecfaf5fff6407f144b7df2a031e4?d=identicon)[ekmungai](/maintainers/ekmungai)

---

Top Contributors

[![ekmungai](https://avatars.githubusercontent.com/u/5164156?v=4)](https://github.com/ekmungai "ekmungai (135 commits)")[![hicka](https://avatars.githubusercontent.com/u/19439535?v=4)](https://github.com/hicka "hicka (22 commits)")[![paschaldev](https://avatars.githubusercontent.com/u/13323281?v=4)](https://github.com/paschaldev "paschaldev (12 commits)")[![jonagoldman](https://avatars.githubusercontent.com/u/1297559?v=4)](https://github.com/jonagoldman "jonagoldman (6 commits)")[![nasirkhan](https://avatars.githubusercontent.com/u/396987?v=4)](https://github.com/nasirkhan "nasirkhan (6 commits)")[![zayedadel](https://avatars.githubusercontent.com/u/7737506?v=4)](https://github.com/zayedadel "zayedadel (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (2 commits)")[![inmanturbo](https://avatars.githubusercontent.com/u/47095624?v=4)](https://github.com/inmanturbo "inmanturbo (2 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![njohnchi](https://avatars.githubusercontent.com/u/70455566?v=4)](https://github.com/njohnchi "njohnchi (1 commits)")[![hakarabakara](https://avatars.githubusercontent.com/u/182207180?v=4)](https://github.com/hakarabakara "hakarabakara (1 commits)")[![bradleybensmith](https://avatars.githubusercontent.com/u/4261448?v=4)](https://github.com/bradleybensmith "bradleybensmith (1 commits)")

---

Tags

laravellumeneloquentreportingAccounting

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/ekmungai-eloquent-ifrs/health.svg)

```
[![Health](https://phpackages.com/badges/ekmungai-eloquent-ifrs/health.svg)](https://phpackages.com/packages/ekmungai-eloquent-ifrs)
```

###  Alternatives

[owen-it/laravel-auditing

Audit changes of your Eloquent models in Laravel

3.4k33.0M95](/packages/owen-it-laravel-auditing)[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[mohammad-fouladgar/eloquent-builder

527189.5k](/packages/mohammad-fouladgar-eloquent-builder)[shiftonelabs/laravel-cascade-deletes

Adds application level cascading deletes to Eloquent Models.

163632.1k2](/packages/shiftonelabs-laravel-cascade-deletes)[altek/accountant

The auditing &amp; accountability package for Laravel's Eloquent ORM.

92954.3k4](/packages/altek-accountant)[veelasky/laravel-hashid

HashId Implementation on Laravel Eloquent ORM

46168.5k3](/packages/veelasky-laravel-hashid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
