• Stars
    star
    254
  • Rank 154,902 (Top 4 %)
  • Language
    PHP
  • License
    MIT License
  • Created about 2 years ago
  • Updated 2 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
131
star
2

laravel-payment-gateways

A simple Laravel API implementation for all payment providers.
PHP
92
star
3

lite-blog

A Laravel blog generator.
PHP
76
star
4

extended-artisan-commands

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

filament-feature-flags

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

filament-debugger

Easily add Laravel Telescope and Horizon to Filament admin panel.
PHP
52
star
7

api-test-helper

A collection of helper methods for testing and debugging API endpoints.
PHP
49
star
8

default-model-sorting

Add custom default sorting column to your eloquent model.
PHP
34
star
9

paystack-payout-

Integrating Paystack checkout system for any website
JavaScript
31
star
10

simple-query-filter

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

paystack-lite

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

filament-jetstream

Integrate all Laravel Jetstream features into your Filament application.
PHP
14
star
13

laravel-code-style

Laravel code style rules
PHP
9
star
14

codebyte-solutions

PHP
5
star
15

LaravelCPanelAutoDeploy

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

laravel-sendportal

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

ProductAPI

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

custom-class-enums

PHP
2
star
19

UserAPI

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

providus-sdk

PHP
1
star
21

plaid-sdk-laravel

PHP
1
star
22

dockerized-laravel-app

A sample dockerized laravel app.
PHP
1
star
23

litemailer

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

personal_bash_profile

Shell
1
star
25

vbank-php-sdk

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

student-result-sheet

Students Termly Result Sheet Template built with tailwindcss
HTML
1
star