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

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

webafra/laravel-user-wallet
===========================

laravel user wallet manager

v2.0.1(2mo ago)0109↓100%1[3 PRs](https://github.com/webafra/laravel-user-wallet/pulls)MITPHPPHP ^8.2CI passing

Since Aug 25Pushed 1mo agoCompare

[ Source](https://github.com/webafra/laravel-user-wallet)[ Packagist](https://packagist.org/packages/webafra/laravel-user-wallet)[ Docs](https://github.com/webafra/laravel-user-wallet)[ GitHub Sponsors](https://github.com/webafra)[ RSS](/packages/webafra-laravel-user-wallet/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (13)Versions (8)Used By (0)

laravel user wallet manager
===========================

[](#laravel-user-wallet-manager)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0e7e6732db611bb7dfdecbce43af4617c6014e023fabb5e18b7016af099ccf49/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776562616672612f6c61726176656c2d757365722d77616c6c65742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/webafra/laravel-user-wallet)[![GitHub Tests Action Status](https://camo.githubusercontent.com/b1693860285393d2f22bdec38a2b73df170c6ece9c16c3b46e61282b49ba0026/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f776562616672612f6c61726176656c2d757365722d77616c6c65742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/webafra/laravel-user-wallet/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/9626358f2a0b466f17cdeee5d8b636fbd4ab33138d1d0931ddd563beeb1b8a53/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f776562616672612f6c61726176656c2d757365722d77616c6c65742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/webafra/laravel-user-wallet/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/fa9af4e3a79b2b0ec5c0c1199b1a8615a3b33b3065c9fb6fce019400fcafe021/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776562616672612f6c61726176656c2d757365722d77616c6c65742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/webafra/laravel-user-wallet)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/0d4d6907b36dae58039395833b39049bafa8e9821d138c66a7a151b558c7a893/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d757365722d77616c6c65742e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-user-wallet)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require webafra/laravel-user-wallet
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="laravel-user-wallet-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-user-wallet-config"
```

### Prepare User Model

[](#prepare-user-model)

To use this package you need to implement the `WalletOperations` into `User` model and utilize the `ManagesWallet` trait.

```
use Webafra\LaravelUserWallet\Interfaces\WalletOperations;
use Webafra\LaravelUserWallet\Traits\ManagesWallet;

class User extends Authenticatable implements WalletOperations
{
    use ManagesWallet;
}
```

### Prepare Wallets

[](#prepare-wallets)

In Laravel Pay Pocket, you have the flexibility to define the order in which wallets are prioritized for payments through the use of Enums. The order of wallets in the Enum file determines their priority level. The first wallet listed has the highest priority and will be used first for deducting order values.

For example, consider the following wallet types defined in the Enum class (published in step 3 of installation):

```
namespace App\Enums;

enum WalletEnums: string
{
    case WALLET1 = 'wallet_1';
    case WALLET2 = 'wallet_2';
}
```

**You have complete freedom to name your wallets as per your requirements and even add more wallet types to the Enum list.**

In this particular setup, `wallet_1` (`WALLET1`) is given the **highest priority**. When an order payment is processed, the system will first attempt to use `wallet_1` to cover the cost. If `wallet_1` does not have sufficient funds, `wallet_2` (`WALLET2`) will be used next.

### Example:

[](#example)

If the balance in `wallet_1` is 10 and the balance in `wallet_2` is 20, and you need to pay an order value of 15, the payment process will first utilize the entire balance of `wallet_1`. Since `wallet_1`'s balance is insufficient to cover the full amount, the remaining 5 will be deducted from `wallet_2`. After the payment, `wallet_2` will have a remaining balance of 15."

Usage, APIs and Operations:
---------------------------

[](#usage-apis-and-operations)

### Deposit

[](#deposit)

```
deposit(type: 'wallet_1', amount: 123.45, notes: null)
```

Deposit funds into `wallet_1`

```
$user = auth()->user();
$user->deposit('wallet_1', 123.45);
```

Deposit funds into `wallet_2`

```
$user = auth()->user();
$user->deposit('wallet_2', 67.89);
```

Or using provided facade

```
use Webafra\LaravelUserWallet\Facades\LaravelUserWallet;

$user = auth()->user();
LaravelUserWallet::deposit($user, 'wallet_1', 123.45);
```

Note: `wallet_1` and `wallet_2` must already be defined in the `WalletEnums`.

#### Transaction Info (\[#8\]\[i8\])

[](#transaction-info-8i8)

When you need to add descriptions for a specific transaction, the `$notes` parameter enables you to provide details explaining the reason behind the transaction.

```
$user = auth()->user();
$user->deposit('wallet_1', 67.89, 'You ordered pizza.');
```

### Pay

[](#pay)

```
pay(amount: 12.34, notes: null)
```

Pay the value using the total combined balance available across all allowed wallets

```
$user = auth()->user();
$user->pay(12.34);
```

Or using provided facade

```
use Webafra\LaravelUserWallet\Facades\LaravelUserWallet;

$user = auth()->user();
LaravelUserWallet::pay($user, 12.34); # decrease from all wallets
LaravelUserWallet::pay($user, 12.34, type: 'wallet_1');
LaravelUserWallet::pay($user, 12.34, type: 'wallet_1', notes: 'payment notes');
```

### Balance

[](#balance)

- **Wallets**

```
$user->walletBalance // Total combined balance available across all wallets

// Or using provided facade

LaravelUserWallet::checkBalance($user);
```

- **Particular Wallet**

```
$user->getWalletBalanceByType('wallet_1') // Balance available in wallet_1
$user->getWalletBalanceByType('wallet_2') // Balance available in wallet_2

// Or using provided facade

LaravelUserWallet::walletBalanceByType($user, 'wallet_1');
```

### Exceptions

[](#exceptions)

Upon examining the `src/Exceptions` directory within the source code, you will discover a variety of exceptions tailored to address each scenario of invalid entry.

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 Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

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

License
-------

[](#license)

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

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance88

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% 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 ~49 days

Total

5

Last Release

62d ago

Major Versions

v1.0.2 → v2.0.02026-03-11

PHP version history (2 changes)v1.0.0PHP ^8.4

v1.0.1PHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![webafra](https://avatars.githubusercontent.com/u/8689072?v=4)](https://github.com/webafra "webafra (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelwebafralaravel-user-wallet

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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