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

ActiveLibrary[Payment Processing](/categories/payments)

algeriany/wallet
================

wallet

v1.0.0(1y ago)18MITPHP

Since Sep 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AlgeRiany01/laravel-wallet-package)[ Packagist](https://packagist.org/packages/algeriany/wallet)[ RSS](/packages/algeriany-wallet/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Wallet Package for Laravel
==========================

[](#wallet-package-for-laravel)

This package provides a simple wallet management system for Laravel applications. It allows users to create wallets, manage funds, and transfer money between wallets.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Creating a Wallet](#creating-a-wallet)
    - [Adding Funds](#adding-funds)
    - [Deducting Funds](#deducting-funds)
    - [Transferring Funds](#transferring-funds)
- [Database Migrations](#database-migrations)
- [Publishing Assets](#publishing-assets)
- [Testing](#testing)
- [License](#license)

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

[](#installation)

To install the package, run the following command:

```
composer require algeriany/wallet
```

Configuration
-------------

[](#configuration)

After installing, you may want to publish the configuration files using the following commands:

```
php artisan vendor:publish --provider="algeriany\wallet\WalletServiceProvider" --tag=models
php artisan vendor:publish --provider="algeriany\wallet\WalletServiceProvider" --tag=migrations
```

Usage
-----

[](#usage)

### Creating a Wallet

[](#creating-a-wallet)

To create a wallet for a user or model that uses the `Walletable` trait, you can do the following:

```
use algeriany\wallet\Models\Wallet;
use algeriany\wallet\Services\WalletService;

// Assuming $user is an instance of a model that uses the Walletable trait
$walletService = new WalletService();
$wallet = $walletService->createWallet($user, 100.00); // Initialize with $100
```

### Adding Funds

[](#adding-funds)

You can add funds to an existing wallet:

```
$walletService->addFunds($wallet, 50.00); // Add $50
```

### Deducting Funds

[](#deducting-funds)

To deduct funds from a wallet:

```
try {
    $walletService->deductFunds($wallet, 20.00); // Deduct $20
} catch (\Exception $e) {
    echo $e->getMessage(); // Handle insufficient funds exception
}
```

### Transferring Funds

[](#transferring-funds)

To transfer funds from one wallet to another:

```
$fromWallet = Wallet::find($fromWalletId);
$toWallet = Wallet::find($toWalletId);

try {
    $walletService->transferFunds($fromWallet, $toWallet, 30.00); // Transfer $30
} catch (\Exception $e) {
    echo $e->getMessage(); // Handle exceptions
}
```

Database Migrations
-------------------

[](#database-migrations)

This package includes migrations for creating the `wallets` and `wallet_transfers` tables. To run the migrations, execute:

```
php artisan migrate
```

### Migrations Structure

[](#migrations-structure)

#### Wallets Table

[](#wallets-table)

- `id`: Unique identifier for the wallet.
- `wallet_id`: Unique String identifier for the wallet.
- `walletable_id`: The ID of the wallet owner (user or model).
- `walletable_type`: The type of the wallet owner (morph relation).
- `balance`: The balance of the wallet.
- `created_at`: Timestamp for wallet creation.
- `updated_at`: Timestamp for last update.

#### Wallet Transfers Table

[](#wallet-transfers-table)

- `id`: Unique identifier for the transfer.
- `from_wallet_id`: ID of the wallet from which funds are transferred.
- `to_wallet_id`: ID of the wallet to which funds are transferred.
- `amount`: Amount transferred.
- `created_at`: Timestamp for the transfer creation.
- `updated_at`: Timestamp for last update.

Publishing Assets
-----------------

[](#publishing-assets)

To publish the models and migrations, run:

```
php artisan vendor:publish --provider="algeriany\wallet\WalletServiceProvider" --tag=models
php artisan vendor:publish --provider="algeriany\wallet\WalletServiceProvider" --tag=migrations
```

License
-------

[](#license)

This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

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

Unknown

Total

1

Last Release

601d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ee768ade6846f2cadd1e2576b471840845416fdeedb396c2316ab7a95cd6317?d=identicon)[AlgeRiany01](/maintainers/AlgeRiany01)

---

Top Contributors

[![AlgeRiany01](https://avatars.githubusercontent.com/u/116391550?v=4)](https://github.com/AlgeRiany01 "AlgeRiany01 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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