mahbodhastam / laravel-user-wallet
This package allows you to create wallet for the users
Fund package maintenance!
MahbodHastam
Requires
- php: ^8.0
- illuminate/collections: ^8.0
- illuminate/contracts: ^8.0
- illuminate/database: ^8.0
- illuminate/support: ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- orchestra/testbench: ^6.19
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.8
README
With this package you can create wallet for the users.
Note: Make sure you've already installed php ^8
Installation
Install the package via composer:
composer require mahbodhastam/laravel-user-wallet
Usage
use MahbodHastam\UserWallet\UserWallet; $wallet = UserWallet::createNewWallet(user_id: 1); $amount = $wallet->amount; $token = $wallet->token;
$wallet = UserWallet::getWallet('abc');
$balance = UserWallet::balance($wallet)['total'];
UserWallet::fill($wallet, 100);
UserWallet::charge($wallet, 500);
UserWallet::send( sender: $wallet1, receiver: $wallet2, value: 50 );
$transaction = UserWallet::makeRequest( value: 300, receiver: $wallet ); // Keep it $hash = $transaction->transaction_hash; UserWallet::closeRequest( sender: $wallet, transaction_hash: $hash );
@userWalletBalance($wallet) {{-- $wallet can be wallet's `id`, `token` or an instance from UserWalletModel --}}
See the Tests for more examples.
Testing
composer test
Todos
- Blade Directives
Changelog
See CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.