承接 stephenjude/laravel-wallet 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

stephenjude/laravel-wallet

最新稳定版本:2.0.4

Composer 安装命令:

composer require stephenjude/laravel-wallet

包简介

A simple wallet implementation for Laravel

README 文档

README

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.

统计信息

  • 总下载量: 11k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 264
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 264
  • Watchers: 5
  • Forks: 22
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-10