• Stars
    star
    263
  • Rank 155,624 (Top 4 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 2 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple wallet implementation for Laravel.

Laravel Wallet

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A simple wallet implementation for Laravel.

Learn More

Installation

You can install the package via composer:

composer require stephenjude/laravel-wallet

You can publish and run the migrations with:

php artisan vendor:publish --tag="wallet-migrations"
php artisan migrate

Usage

Prepare User Model

use Stephenjude\Wallet\Interfaces\Wallet;
use Stephenjude\Wallet\Traits\HasWallet;

class User extends Authenticatable implements Wallet
{
    use HasWallet;
}

Deposit

$user = User::first();

$user->deposit(200.22); // returns the wallet balance: 200.22

$user->deposit(200); // returns the wallet balance: 400.22

Withdraw

$user->withdraw(200); // returns the wallet balance: 200.22

$user->withdraw(0.22); // returns the wallet balance: 200

Balance

$user->balance

$user->wallet_balance

Exceptions

InvalidAmountException

The InvalidAmountException is thrown whenever the deposit or withdrawal amount is a negative numeric value or zero.

InsufficientFundException

The InsufficientFundException is thrown whenever the withdrawal amount is less than the user's wallet balance.

Alternative Package

If you are looking for somthing much bigger and elaborate checkout Bavix Laravel Wallet.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

More Repositories

1

filament-blog

A faceless blog content manager with configurable richtext and markdown support for filament admin panel
PHP
151
star
2

filament-jetstream

Integrate all Laravel Jetstream features into your Filament application.
PHP
111
star
3

laravel-payment-gateways

A simple Laravel API implementation for all payment providers.
PHP
102
star
4

lite-blog

A Laravel blog generator.
PHP
76
star
5

filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.
PHP
76
star
6

extended-artisan-commands

Generate plain PHP classes, traits and interfaces using artisan console commands.
PHP
71
star
7

filament-debugger

Easily add Laravel Telescope and Horizon to Filament admin panel.
PHP
70
star
8

api-test-helper

A collection of helper methods for testing and debugging API endpoints.
PHP
48
star
9

default-model-sorting

Add custom default sorting column to your eloquent model.
PHP
35
star
10

paystack-payout-

Integrating Paystack checkout system for any website
JavaScript
31
star
11

simple-query-filter

This package allows you to filter eloquent model queries based on HTTP request.
PHP
31
star
12

paystack-lite

Fastest Way To Setup Paystack Checkout Form In Your Laravel Application
PHP
22
star
13

laravel-code-style

Laravel code style rules
PHP
9
star
14

codebyte-solutions

PHP
5
star
15

filament-two-factor-authentication

Add two factor authentication (2FA) to Filament panels.
PHP
4
star
16

laravel-sendportal

The Laravel Package (Unofficial) to work with the SendPortal APIs
PHP
3
star
17

LaravelCPanelAutoDeploy

Auto deploy yml for auto deploying Laravel on CPanel
3
star
18

ProductAPI

A simple Lumen API using Test Driven Developement Approach
PHP
3
star
19

dockerized-laravel-app

A sample dockerized laravel app.
PHP
2
star
20

custom-class-enums

PHP
2
star
21

UserAPI

A sample project on how to test PHP Traits
PHP
1
star
22

providus-sdk

PHP
1
star
23

plaid-sdk-laravel

PHP
1
star
24

litemailer

An email sending application where user can add different email addresses and send out mass emails.
PHP
1
star
25

personal_bash_profile

Shell
1
star
26

vbank-php-sdk

Laravel PHP SDK to easily work with the VDF Microfinance Bank APIs.
PHP
1
star
27

student-result-sheet

Students Termly Result Sheet Template built with tailwindcss
HTML
1
star