Stars: 241
Forks: 18
Pull Requests: 16
Issues: 2
Watchers: 8
Last Updated: 2023-09-11 01:36:57
A simple wallet implementation for Laravel.
License: MIT License
Languages: PHP
A simple wallet implementation for Laravel.
You can install the package via composer:
composer require stephenjude/laravel-walletYou can publish and run the migrations with:
php artisan vendor:publish --tag="wallet-migrations"
php artisan migrateuse Stephenjude\Wallet\Interfaces\Wallet;
use Stephenjude\Wallet\Traits\HasWallet;
class User extends Authenticatable implements Wallet
{
use HasWallet;
}$user = User::first();
$user->deposit(200.22); // returns the wallet balance: 200.22
$user->deposit(200); // returns the wallet balance: 400.22$user->withdraw(200); // returns the wallet balance: 200.22
$user->withdraw(0.22); // returns the wallet balance: 200$user->balance
$user->wallet_balanceThe InvalidAmountException is thrown whenever the deposit or withdrawal amount is a negative numeric value or zero.
The InsufficientFundException is thrown whenever the withdrawal amount is less than the user's wallet balance.
If you are looking for somthing much bigger and elaborate checkout Bavix Laravel Wallet.
composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.