PHPackages                             vswarte/laravel-ledger - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. vswarte/laravel-ledger

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

vswarte/laravel-ledger
======================

Simple ledger package

6276↓75%5[3 issues](https://github.com/vswarte/laravel-ledger/issues)PHP

Since Apr 17Pushed 6y agoCompare

[ Source](https://github.com/vswarte/laravel-ledger)[ Packagist](https://packagist.org/packages/vswarte/laravel-ledger)[ RSS](/packages/vswarte-laravel-ledger/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Ledger
==============

[](#laravel-ledger)

Simple package to keep a track of monetary transactions.

Usage
-----

[](#usage)

First off you'll need to add the `Accountable` trait to the Eloquent models you want to start tracking transactions for.

```
use Ledger\Accountable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable, Accountable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
}
```

### Creating an account

[](#creating-an-account)

An account is simply an entity with a balance, All mutations will be performed on these accounts. A single accountable can have multiple accounts. You can create an account for a singular user like this:

```
User::find(1)->createAccount('groceries', 'Day-to-day groceries');
```

The first parameter singifies the name of the account, this must be unique in the scope of the `Accountable` as you'll be using it as an identifier. The second parameter is simply a description.

### Creating a transaction

[](#creating-a-transaction)

There are several types of transactions, simple withdrawals to transfers. Transactions are simply a way of grouping mutations. This way you can set up a transaction that operates on multiple accounts easily.

#### Simple credit/debit

[](#simple-creditdebit)

We just want to take/add some money from/to an account.

```
use Ledger\TransactionFactory;

// 5 euro
$amount  = new Money::EUR(500);
$account = User::find(1)->account('groceries');
TransactionFactory::debit($account, $amount, 'bought some vegetables');
```

#### Transfers

[](#transfers)

In some cases, we want to take money from one account, and put it in a different account (be it paying for something or allocating savings).

```
use Ledger\TransactionFactory;

$amount = new Money::EUR(500);
$from   = User::find(1)->account('salary');
$to     = User::find(1)->account('car');
TransactionFactory::transfer(
    $from,
    $to,
    $amount,
    'monthly savings'
);
```

### Fetching account balance

[](#fetching-account-balance)

An account is not very useful without being able to query its balance. The balance itself is simply the sum of all credit mutations with the sum of the debit transactions subtracted.

```
User::find(1)->account('groceries')->balance();
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 64.3% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6827387?v=4)[Vincent Swarte](/maintainers/vswarte)[@vswarte](https://github.com/vswarte)

---

Top Contributors

[![vswarte](https://avatars.githubusercontent.com/u/6827387?v=4)](https://github.com/vswarte "vswarte (9 commits)")[![nholliday](https://avatars.githubusercontent.com/u/226395?v=4)](https://github.com/nholliday "nholliday (4 commits)")[![ikidnapmyself](https://avatars.githubusercontent.com/u/13779866?v=4)](https://github.com/ikidnapmyself "ikidnapmyself (1 commits)")

### Embed Badge

![Health badge](/badges/vswarte-laravel-ledger/health.svg)

```
[![Health](https://phpackages.com/badges/vswarte-laravel-ledger/health.svg)](https://phpackages.com/packages/vswarte-laravel-ledger)
```

###  Alternatives

[leafo/lessphp

lessphp is a compiler for LESS written in PHP.

2.2k8.2M141](/packages/leafo-lessphp)[realrashid/sweet-alert

Laravel Sweet Alert Is A Package For Laravel Provides An Easy Way To Display Alert Messages Using The SweetAlert2 Library.

1.2k2.9M21](/packages/realrashid-sweet-alert)[symfony/polyfill-php55

Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions

10731.7M9](/packages/symfony-polyfill-php55)[helmich/typo3-typoscript-lint

Static code analysis for the TypoScript configuration language.

902.9M241](/packages/helmich-typo3-typoscript-lint)[cyclonedx/cyclonedx-php-composer

Creates CycloneDX Software Bill-of-Materials (SBOM) from PHP Composer projects

821.6M17](/packages/cyclonedx-cyclonedx-php-composer)[kartik-v/yii2-widget-touchspin

A Yii2 wrapper widget for the Bootstrap Switch plugin to use checkboxes &amp; radios as toggle touchspines (sub repo split from yii2-widgets)

184.1M6](/packages/kartik-v-yii2-widget-touchspin)

PHPackages © 2026

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