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

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

centrex/laravel-wallet
======================

Add wallet functionality in laravel application

v1.1.0(1y ago)02.5k[1 PRs](https://github.com/centrex/laravel-wallet/pulls)MITPHPPHP ^8.2|^8.3|^8.4CI passing

Since Dec 28Pushed 1w agoCompare

[ Source](https://github.com/centrex/laravel-wallet)[ Packagist](https://packagist.org/packages/centrex/laravel-wallet)[ Docs](https://github.com/centrex/laravel-wallet)[ RSS](/packages/centrex-laravel-wallet/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (14)Versions (11)Used By (0)

Add wallet functionality to Laravel applications
================================================

[](#add-wallet-functionality-to-laravel-applications)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1de4c54612dfc1db31ef41e17fe146ae49451cef433c752e7272c2ecca341e62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63656e747265782f6c61726176656c2d77616c6c65742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/centrex/laravel-wallet)[![GitHub Tests Action Status](https://camo.githubusercontent.com/eaa1235e66f1aebabd95ac9f9bcff83bd4b3ed32908b244c67c73d242892e5d0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63656e747265782f6c61726176656c2d77616c6c65742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/centrex/laravel-wallet/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/bbaba876d2b97258b77e32dbb962b9c9b4c50b6c36db83decded858d9624e287/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63656e747265782f6c61726176656c2d77616c6c65742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/centrex/laravel-wallet/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/711fee40208d14d7fc8352d0b3196e5e2583c0ed10087e813296d4ca31137f91/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63656e747265782f6c61726176656c2d77616c6c65743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/centrex/laravel-wallet)

Polymorphic digital wallet for any Eloquent model. Supports multiple wallet types per user, balance increments/decrements, and an immutable ledger of all transactions.

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

[](#installation)

```
composer require centrex/laravel-wallet
php artisan vendor:publish --tag="laravel-wallet-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

### 1. Add the trait to your model

[](#1-add-the-trait-to-your-model)

```
use Centrex\Wallet\Traits\HasWallet;

class User extends Authenticatable
{
    use HasWallet;
}
```

A default wallet is created automatically when the model is created.

### 2. Access wallets

[](#2-access-wallets)

```
// All wallets for this user
$user->wallets;

// Specific wallet by type ID
$wallet = $user->wallet(WalletType::DEFAULT->value);

echo $wallet->balance;
```

### 3. Credit and debit

[](#3-credit-and-debit)

```
// Credit by amount
$wallet->incrementBalance(500.00);

// Debit by amount
$wallet->decrementBalance(200.00);

// Credit via a WalletTransaction model (links transaction to ledger entry)
$wallet->incrementBalance($transaction);
$wallet->decrementBalance($transaction);
```

### 4. Ledger

[](#4-ledger)

Every balance change is recorded in `wallet_ledgers` with the transaction reference and running balance:

```
$wallet->walletLedgers;
// → collection of WalletLedger with: amount, running_raw_balance, transaction_id, transaction_type
```

### Wallet types

[](#wallet-types)

```
use Centrex\Wallet\Enums\WalletType;

WalletType::DEFAULT   // value: 1
WalletType::TEMPORAY  // value: 2
```

### Cleanup on delete

[](#cleanup-on-delete)

When the parent model is deleted, all its wallets are automatically deleted via the `deleting` boot hook.

Testing
-------

[](#testing)

```
composer test        # full suite
composer test:unit   # pest only
composer test:types  # phpstan
composer lint        # pint
```

Changelog
---------

[](#changelog)

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

Credits
-------

[](#credits)

- [centrex](https://github.com/centrex)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance72

Regular maintenance activity

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 54.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 ~101 days

Total

5

Last Release

514d ago

Major Versions

v0.0.1 → v1.0.02023-12-30

PHP version history (3 changes)v0.0.1PHP ^8.0|^8.1

v1.0.0PHP ^8.1|^8.2

v1.1.0PHP ^8.2|^8.3|^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29769944?v=4)[Raisul Islam](/maintainers/rochi88)[@rochi88](https://github.com/rochi88)

---

Top Contributors

[![rochi88](https://avatars.githubusercontent.com/u/29769944?v=4)](https://github.com/rochi88 "rochi88 (36 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (15 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")[![kolazsys](https://avatars.githubusercontent.com/u/110965082?v=4)](https://github.com/kolazsys "kolazsys (7 commits)")

---

Tags

laravellaravel-walletcentrex

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[wearepixel/laravel-cart

A cart implementation for Laravel

1374.8k](/packages/wearepixel-laravel-cart)

PHPackages © 2026

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