PHPackages                             zotel/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. [Payment Processing](/categories/payments)
4. /
5. zotel/laravel-wallet

ActiveLibrary[Payment Processing](/categories/payments)

zotel/laravel-wallet
====================

It's easy to work with a virtual wallet.

v1.7.0(10mo ago)05.8k—6.8%[13 PRs](https://github.com/piyushjaiswal7668/zotel-laravel-wallet/pulls)MITPHPPHP ^8.2CI passing

Since Aug 25Pushed 5mo agoCompare

[ Source](https://github.com/piyushjaiswal7668/zotel-laravel-wallet)[ Packagist](https://packagist.org/packages/zotel/laravel-wallet)[ Docs](https://bavix.github.io/laravel-wallet/)[ Fund](https://www.tinkoff.ru/cf/1OkIPwTvTLf)[ Fund](https://opencollective.com/laravel-wallet)[ RSS](/packages/zotel-laravel-wallet/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (15)Versions (23)Used By (0)

[![Laravel Wallet](https://private-user-images.githubusercontent.com/5111255/342062304-95e7877c-a950-4b04-9414-de62216d31c2.jpeg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODI2ODY1MzMsIm5iZiI6MTc4MjY4NjIzMywicGF0aCI6Ii81MTExMjU1LzM0MjA2MjMwNC05NWU3ODc3Yy1hOTUwLTRiMDQtOTQxNC1kZTYyMjE2ZDMxYzIuanBlZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxd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_ATGg18)

laravel-wallet - It's easy to work with a virtual wallet.

\[[Benchmark](https://github.com/bavix/laravel-wallet-benchmark/)\] \[[Documentation](https://piyushjaiswal7668.github.io/zotel-laravel-wallet/)\] \[[Get Started](https://bavix.github.io/laravel-wallet/guide/introduction/)\]

- **Vendor**: zotel
- **Package**: laravel-wallet
- **[Composer](https://getcomposer.org/):** `composer require zotel-laravel-wallet`

### Support Policy

[](#support-policy)

VersionLaravelPHPRelease dateEnd of improvementsEnd of support1.x \[LTS\]^11.0, ^12.08.2,8.3,8.4Aug 25, 2025Aug 25, 2025Sep 6, 2026### Upgrade Guide

[](#upgrade-guide)

To perform the migration, you will be [helped by the instruction](https://bavix.github.io/laravel-wallet/#/upgrade-guide).

### Community

[](#community)

I want to create a cozy place for developers using the wallet package. This will help you find bugs faster, get feedback and discuss ideas.

### Extensions

[](#extensions)

ExtensionDescription[Swap](https://github.com/bavix/laravel-wallet-swap)Addition to the laravel-wallet library for quick setting of exchange rates[uuid](https://github.com/bavix/laravel-wallet-uuid)Addition to laravel-wallet to support model uuid keys[Warm Up](https://github.com/bavix/laravel-wallet-warmup)Addition to the laravel-wallet library for refresh balance wallets### Usage

[](#usage)

Add the `HasWallet` trait and `Wallet` interface to model.

```
use Zotel\Wallet\Traits\HasWallet;
use Zotel\Wallet\Interfaces\Wallet;

class User extends Model implements Wallet
{
    use HasWallet;
}
```

Now we make transactions.

```
$user = User::first();
$user->balanceInt; // 0

$user->deposit(10);
$user->balance; // 10
$user->balanceInt; // int(10)

$user->withdraw(1);
$user->balance; // 9

$user->forceWithdraw(200, ['description' => 'payment of taxes']);
$user->balance; // -191
```

### Purchases

[](#purchases)

Add the `CanPay` trait and `Customer` interface to your `User` model.

```
use Zotel\Wallet\Traits\CanPay;
use Zotel\Wallet\Interfaces\Customer;

class User extends Model implements Customer
{
    use CanPay;
}
```

Add the `HasWallet` trait and interface to `Item` model.

Starting from version 9.x there are two product interfaces:

- For an unlimited number of products (`ProductInterface`);
- For a limited number of products (`ProductLimitedInterface`);

An example with an unlimited number of products:

```
use Zotel\Wallet\Traits\HasWallet;
use Zotel\Wallet\Interfaces\Customer;
use Zotel\Wallet\Interfaces\ProductInterface;

class Item extends Model implements ProductInterface
{
    use HasWallet;

    public function getAmountProduct(Customer $customer): int|string
    {
        return 100;
    }

    public function getMetaProduct(): ?array
    {
        return [
            'title' => $this->title,
            'description' => 'Purchase of Product #' . $this->id,
        ];
    }
}
```

Example with a limited number of products:

```
use Zotel\Wallet\Traits\HasWallet;
use Zotel\Wallet\Interfaces\Customer;
use Zotel\Wallet\Interfaces\ProductLimitedInterface;

class Item extends Model implements ProductLimitedInterface
{
    use HasWallet;

    public function canBuy(Customer $customer, int $quantity = 1, bool $force = false): bool
    {
        /**
         * This is where you implement the constraint logic.
         *
         * If the service can be purchased once, then
         *  return !$customer->paid($this);
         */
        return true;
    }

    public function getAmountProduct(Customer $customer): int|string
    {
        return 100;
    }

    public function getMetaProduct(): ?array
    {
        return [
            'title' => $this->title,
            'description' => 'Purchase of Product #' . $this->id,
        ];
    }
}
```

I do not recommend using the limited interface when working with a shopping cart. If you are working with a shopping cart, then you should override the `PurchaseServiceInterface` interface. With it, you can check the availability of all products with one request, there will be no N-queries in the database.

Proceed to purchase.

```
$user = User::first();
$user->balance; // 100

$item = Item::first();
$user->pay($item); // If you do not have enough money, throw an exception
var_dump($user->balance); // 0

if ($user->safePay($item)) {
  // try to buy again
}

var_dump((bool)$user->paid($item)); // bool(true)

var_dump($user->refund($item)); // bool(true)
var_dump((bool)$user->paid($item)); // bool(false)
```

### Eager Loading

[](#eager-loading)

```
// When working with one wallet
User::with('wallet');

// When using the multi-wallet functionality
User::with('wallets');
```

### How to work with fractional numbers?

[](#how-to-work-with-fractional-numbers)

Add the `HasWalletFloat` trait and `WalletFloat` interface to model.

```
use Zotel\Wallet\Traits\HasWalletFloat;
use Zotel\Wallet\Interfaces\WalletFloat;
use Zotel\Wallet\Interfaces\Wallet;

class User extends Model implements Wallet, WalletFloat
{
    use HasWalletFloat;
}
```

Now we make transactions.

```
$user = User::first();
$user->balance; // 100
$user->balanceFloat; // 1.00

$user->depositFloat(1.37);
$user->balance; // 237
$user->balanceFloat; // 2.37
```

### Performance Comparison

[](#performance-comparison)

All versions:

Name7.38.49.610.111.0Atomic:Blocks--484ms493ms493msCart:EagerLoaderPay22s679ms493ms530ms652msCart:Pay1.36s472ms288ms298ms336msCart:PayFree1.3s415ms281ms291ms287msCart:PayOneItemXPieces565ms118ms59.1ms64.6ms66.2msGift:Gift44.8ms53.5ms54.3ms58.4ms64.3msGift:Refund106ms112ms108ms111ms139msSolo:Deposit27.4ms31.8ms31ms33.3ms30.1msSolo:EagerLoading904ms1.09s876ms927ms1.02sSolo:ForceWithdraw27.6ms31.8ms30.7ms32.9ms30msSolo:GetBalance20.8ms24ms23.7ms23.4ms20msSolo:Transfer39.4ms45.7ms42ms44.9ms46.6msSolo:Withdraw31.1ms36.3ms34.9ms37.3ms37.8msState:InTransaction570ms566ms419ms425ms427msState:RefreshInTransaction32.3ms41.2ms41.2ms45.6ms47.2msState:TransactionRollback29.7ms34.1ms32.9ms37.2ms36.9msTable generated using [benchmark](https://github.com/bavix/laravel-wallet-benchmark/). [Pull Request](https://github.com/bavix/laravel-wallet-benchmark/pull/51).

Contributors
------------

[](#contributors)

### Code Contributors

[](#code-contributors)

This project exists thanks to all the people who contribute. \[[Contribute](CONTRIBUTING.md)\]. [![](https://camo.githubusercontent.com/250ed6eb5180c053298850feeabd99e6d1217c9189e49f7e623cd6d09ec76f91/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6c61726176656c2d77616c6c65742f636f6e7472696275746f72732e7376673f77696474683d38393026627574746f6e3d66616c7365)](https://github.com/bavix/laravel-wallet/graphs/contributors)

### Financial Contributors

[](#financial-contributors)

Become a financial contributor and help us sustain our community. \[[Contribute](https://opencollective.com/laravel-wallet/contribute)\]

#### Individuals

[](#individuals)

[![](https://camo.githubusercontent.com/d5ce74091ab4cb617607636e0763d0f4b32e906810ce3ea613d5169023cc355a/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f6c61726176656c2d77616c6c65742f696e646976696475616c732e7376673f77696474683d383930)](https://opencollective.com/laravel-wallet)

#### Organizations

[](#organizations)

Support this project with your organization. Your logo will show up here with a link to your website. \[[Contribute](https://opencollective.com/laravel-wallet/contribute)\]

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance63

Regular maintenance activity

Popularity24

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.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 ~0 days

Total

8

Last Release

311d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ebc45f16106e79550e4bafccc1ba7083e95dca9b657f81bbf4923b2b3f546a3b?d=identicon)[piyushjaiswal7668](/maintainers/piyushjaiswal7668)

---

Top Contributors

[![rez1dent3](https://avatars.githubusercontent.com/u/5111255?v=4)](https://github.com/rez1dent3 "rez1dent3 (1726 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (176 commits)")[![bavixbot](https://avatars.githubusercontent.com/u/142083844?v=4)](https://github.com/bavixbot "bavixbot (51 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (15 commits)")[![gkmk](https://avatars.githubusercontent.com/u/4238408?v=4)](https://github.com/gkmk "gkmk (13 commits)")[![justinkekeocha](https://avatars.githubusercontent.com/u/39213342?v=4)](https://github.com/justinkekeocha "justinkekeocha (11 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (11 commits)")[![piyushjaiswal7668](https://avatars.githubusercontent.com/u/67449009?v=4)](https://github.com/piyushjaiswal7668 "piyushjaiswal7668 (10 commits)")[![keatliang2005](https://avatars.githubusercontent.com/u/473990?v=4)](https://github.com/keatliang2005 "keatliang2005 (5 commits)")[![snyk-bot](https://avatars.githubusercontent.com/u/19733683?v=4)](https://github.com/snyk-bot "snyk-bot (5 commits)")[![adesege](https://avatars.githubusercontent.com/u/20769821?v=4)](https://github.com/adesege "adesege (3 commits)")[![cispl-shaswatad](https://avatars.githubusercontent.com/u/59719293?v=4)](https://github.com/cispl-shaswatad "cispl-shaswatad (2 commits)")[![omarhen](https://avatars.githubusercontent.com/u/5448144?v=4)](https://github.com/omarhen "omarhen (1 commits)")[![reedknight](https://avatars.githubusercontent.com/u/9690079?v=4)](https://github.com/reedknight "reedknight (1 commits)")[![Thiritin](https://avatars.githubusercontent.com/u/6755282?v=4)](https://github.com/Thiritin "Thiritin (1 commits)")[![adriangonzales](https://avatars.githubusercontent.com/u/486071?v=4)](https://github.com/adriangonzales "adriangonzales (1 commits)")[![akhedrane](https://avatars.githubusercontent.com/u/297340?v=4)](https://github.com/akhedrane "akhedrane (1 commits)")[![Beagon](https://avatars.githubusercontent.com/u/2945583?v=4)](https://github.com/Beagon "Beagon (1 commits)")[![emontano-bit](https://avatars.githubusercontent.com/u/115505444?v=4)](https://github.com/emontano-bit "emontano-bit (1 commits)")[![hsharghi](https://avatars.githubusercontent.com/u/2873823?v=4)](https://github.com/hsharghi "hsharghi (1 commits)")

---

Tags

laravelcurrencylaravel-packagepaymentswalletvirtualcreditslaravel-walletzotel

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleECS

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.3M19](/packages/bavix-laravel-wallet)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[illuminate/queue

The Illuminate Queue package.

21332.6M1.6k](/packages/illuminate-queue)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[bavix/laravel-wallet-swap

Addition to the package laravel-wallet.

2529.6k](/packages/bavix-laravel-wallet-swap)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)

PHPackages © 2026

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