yasser-elgammal/laravel-easy-wallet

A package to make easy wallet for laravel projects.

1.0.0 2025-07-18 13:12 UTC

This package is not auto-updated.

Last update: 2025-07-19 06:53:17 UTC


README

Laravel Easy Wallet is a simple and extensible wallet system for Laravel applications. It allows you to associate wallets with any model, manage balances, and record transactions with support for credit and debit operations using enums.

πŸš€ Features

  • Attach a wallet to any Eloquent model (walletable)
  • Automatically create a wallet if it doesn’t exist
  • Credit and debit balance safely inside a DB transaction
  • Transaction history tracking

πŸ“¦ Installation

composer require yasser-elgammal/easy-wallet

πŸ’Έ Usage Example

1. Credit Wallet

use EasyWallet;
use App\Models\User;

$user = User::find(1);

EasyWallet::credit($user, 100.00, 'Initial deposit');

2. Debit Wallet

EasyWallet::debit($user, 25.00, 'Purchased course');

3. Transfer Between Wallets

$fromUser = User::find(1);
$toUser = User::find(2);

EasyWallet::transfer($fromUser, $toUser, 40.00, 'Transfer to friend');

4. Get Wallet Balance

$balance = EasyWallet::balance($user);

🀝 Contributing

Contributions are welcome and appreciated!

If you have an idea, feature request, bug fix, or any improvement:

  • Feel free to open an issue.
  • Submit a Pull Request.
  • Or simply get in touch if you need help.

Thank you for supporting the project! πŸ™Œ