PHPackages                             coreproc/laravel-wallet-plus - 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. coreproc/laravel-wallet-plus

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

coreproc/laravel-wallet-plus
============================

Easily add a virtual wallet to your Laravel models. Features multiple wallets and a ledger system to help keep track of all transactions in the wallets.

2.0.0(5mo ago)2914.6k↑150%12[3 issues](https://github.com/CoreProc/laravel-wallet-plus/issues)MITPHPPHP ^8.2CI passing

Since Jan 17Pushed 5mo ago5 watchersCompare

[ Source](https://github.com/CoreProc/laravel-wallet-plus)[ Packagist](https://packagist.org/packages/coreproc/laravel-wallet-plus)[ Docs](https://github.com/coreproc/laravel-wallet-plus)[ RSS](/packages/coreproc-laravel-wallet-plus/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (7)Versions (10)Used By (0)

Laravel Wallet Plus
===================

[](#laravel-wallet-plus)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fb83ebb8ac3825768a6637a673333d65c5de31e7386b9066f84909b4f828c9c6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f726570726f632f6c61726176656c2d77616c6c65742d706c75732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/coreproc/laravel-wallet-plus)[![Quality Score](https://camo.githubusercontent.com/43ef2d70328d845f730abc5aa727071bc64451f13d7754f4da9ab0d4ef1b3eaf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636f726570726f632f6c61726176656c2d77616c6c65742d706c75732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/coreproc/laravel-wallet-plus)[![GitHub Tests Action Status](https://camo.githubusercontent.com/8e5004de06db0fa0754be1ae8defde6138fae84457781c09ae418ee0ed4cde72/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f636f726570726f632f6c61726176656c2d77616c6c65742d706c75732f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/coreproc/laravel-wallet-plus/actions?query=workflow%3Arun-tests+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/88b111adaf409f952214be201d89d3243430a29aa810b30f8aea1f268585f6dc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f726570726f632f6c61726176656c2d77616c6c65742d706c75732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/coreproc/laravel-wallet-plus)

Easily add a virtual wallet to your Laravel models. Features multiple wallets and a ledger system to help keep track of all transactions in the wallets.

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

[](#installation)

You can install the package via composer:

```
composer require coreproc/laravel-wallet-plus
```

You can publish the migration with:

```
php artisan vendor:publish --provider="CoreProc\WalletPlus\WalletPlusServiceProvider" --tag="migrations"
```

After the migration file has been published you can create the wallet-plus tables by running the migration:

```
php artisan migrate
```

Usage
-----

[](#usage)

First, you'll need to add the `HasWallets` trait to your model.

```
use CoreProc\WalletPlus\Models\Traits\HasWallets;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable, HasWallets;
}
```

By adding the `HasWallets` trait, you've essentially added all the wallet relationships to the model.

You can start by creating a wallet for the given model.

```
$user = User::find(1);

$wallet = $user->wallets()->create();
```

You can then increment the wallet balance by:

```
$wallet->incrementBalance(100);
```

Or decrement the balance by:

```
$wallet->decrementBalance(100);
```

To get the balance of the wallet, you can use the `balance` accessor:

```
$wallet->balance;
```

A wallet can be accessed using the `wallet()` method in the model:

```
$user->wallet();
```

You can set up multiple types of wallets by defining a `WalletType`. Simply create a wallet type entry in the `wallet_types` table and create a wallet using this wallet type.

```
use CoreProc\WalletPlus\Models\WalletType;

$walletType = WalletType::create([
    'name' => 'Peso Wallet',
    'decimals' => 2, // Set how many decimal points your wallet accepts here. Defaults to 0.
]);

$user->wallets()->create(['wallet_type_id' => $walletType->id]);
```

You can access a model's particular wallet type by using the `wallet()` method as well:

```
$pesoWallet = $user->wallet('Peso Wallet'); // This method also accepts the ID of the wallet type as a parameter

$pesoWallet->incrementBalance(100);

$pesoWallet->balance; // Returns the updated balance without having to refresh the model.
```

All movements made in the wallet are recorded in the `wallet_ledgers` table.

### Defining Transactions

[](#defining-transactions)

Ideally, we want to record all transactions concerning the wallet by linking it to a transaction model. Let's say we have a `PurchaseTransaction` model which holds the data of a purchase the user makes in our app.

```
use Illuminate\Database\Eloquent\Model;

class PurchaseTransaction extends Model
{
    //
}
```

We can link this `PurchaseTransaction` to the wallet ledger by implementing the `WalletTransaction` contract to this model and using this transaction to decrement (or increment, whatever the case may be) the wallet balance.

```
use CoreProc\WalletPlus\Contracts\WalletTransaction;
use Illuminate\Database\Eloquent\Model;

class PurchaseTransaction extends Model implements WalletTransaction
{
    public function getAmount()
    {
        return $this->amount;
    }
}
```

Now we can use this in the wallet:

```
$wallet = $user->wallet('Peso Wallet');

$purchaseTransaction = PurchaseTransaction::create([
    ...,
    'amount' => 100,
]);

$wallet->decrementBalance($purchaseTransaction);
```

By doing this, you will be able to see in the `wallet_ledgers` table the transaction that is related to the movement in the wallet.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Chris Bautista](https://github.com/chrisbjr)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance68

Regular maintenance activity

Popularity36

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% 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 ~305 days

Recently: every ~529 days

Total

8

Last Release

174d ago

Major Versions

1.x-dev → 2.0.02025-11-26

PHP version history (3 changes)1.0.0PHP ^7.3

1.5.0PHP ^7.3 || ^8.0

2.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7066371?v=4)[CoreProc](/maintainers/coreproc)[@CoreProc](https://github.com/CoreProc)

---

Top Contributors

[![chrisbjr](https://avatars.githubusercontent.com/u/571279?v=4)](https://github.com/chrisbjr "chrisbjr (14 commits)")[![myraoliveros-cp](https://avatars.githubusercontent.com/u/69137503?v=4)](https://github.com/myraoliveros-cp "myraoliveros-cp (1 commits)")[![welox](https://avatars.githubusercontent.com/u/38928214?v=4)](https://github.com/welox "welox (1 commits)")

---

Tags

coreproclaravel-wallet-plus

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/coreproc-laravel-wallet-plus/health.svg)

```
[![Health](https://phpackages.com/badges/coreproc-laravel-wallet-plus/health.svg)](https://phpackages.com/packages/coreproc-laravel-wallet-plus)
```

###  Alternatives

[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[laracraft-tech/laravel-useful-additions

A collection of useful Laravel additions!

58109.4k](/packages/laracraft-tech-laravel-useful-additions)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)

PHPackages © 2026

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