2017 © Pedro Peláez
 

library wallet

Easy to plug wallet system in any app

image

owlgrin/wallet

Easy to plug wallet system in any app

  • Monday, June 1, 2015
  • by owlgrin
  • Repository
  • 4 Watchers
  • 15 Stars
  • 93 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 14 Open issues
  • 6 Versions
  • 2 % Grown

The README.md

wallet

Wallet allows you to maintain credits for your users., (*1)

Installation

To install the package, include the following in your composer.json., (*2)

"owlgrin/wallet": "dev-master"

And then include the following service provider in your app.php., (*3)

'Owlgrin\Wallet\WalletServiceProvider'

And lastly, publish the config., (*4)

php artisan config:publish owlgrin/wallet

Usage

Write this command in your artisan to create migrations, (*5)

php artisan wallet:table

Now migrate all the tables to your mysql db, (*6)

php artisan migrate

You can initiate wallet by writing, (*7)

Wallet::user($userId)

where $userId is the unique id of your user, (*8)

Credits, (*9)

You can add credits of your user, (*10)

Wallet::credits($credits, $redemptions)

where $credits is the amount of credits you want to add for your user and $redemptions is number of times you want your user to use these credits, (*11)

Redemptions, (*12)

You can redeem the credits by using, (*13)

Wallet::redeem($amount)

where $amount is the requested amount on which you want to access the credit, (*14)

Left Credits, (*15)

You can see the left credits by using, (*16)

Wallet::left();

Exceptions, (*17)

Wallet comes with custom exceptions, to make them easier to handle. These are the followin custom exceptions that you can use:, (*18)

Owlgrin\Wallet\Exceptions\CreditsLimitReachedException;
Owlgrin\Wallet\Exceptions\NoCreditsException;
Owlgrin\Wallet\Exceptions\InternalException;

Each of these extend an abstract class Owlgrin\Wallet\Exceptions\Exception., (*19)

You can use it like following:, (*20)


try { Wallet::Redeem(5445); } catch(Owlgrin\Wallet\Exceptions\NoCreditsException $e) { return $e; } catch(Owlgrin\Wallet\Exceptions $e) { return $e; }

The Versions

01/06 2015

dev-master

9999999-dev

Easy to plug wallet system in any app

  Sources   Download

The Requires

 

by Mohit Mamoria

01/06 2015

v2.1.0

2.1.0.0

Easy to plug wallet system in any app

  Sources   Download

The Requires

 

by Mohit Mamoria

08/05 2015

v2.0.0

2.0.0.0

Easy to plug wallet system in any app

  Sources   Download

The Requires

 

by Mohit Mamoria

13/04 2015

v0.1.1

0.1.1.0

Easy to plug wallet system in any app

  Sources   Download

The Requires

 

by Mohit Mamoria

13/04 2015

v1.0

1.0.0.0

Easy to plug wallet system in any app

  Sources   Download

The Requires

 

by Mohit Mamoria

09/04 2015

v0.1.0

0.1.0.0

Easy to plug wallet system in any app

  Sources   Download

The Requires

 

by Mohit Mamoria