PHP Classes

PHP Wallet : Perform operations with amounts in a wallet

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-10-27 (10 months ago) RSS 2.0 feedNot enough user ratingsTotal: 66 All time: 10,363 This week: 89Up
Version License PHP version Categories
algo_dgw 1.0.0MIT/X Consortium ...5PHP 5, Finances
Description 

Author

This package can perform operations with amounts in a wallet.

It provides a class that stores money amounts and can perform several types of financial operations with those amounts.

Currently, it can:

- Set the initial balance

- Get the current balance

- Deposit a given amount in the wallet

- Withdraw a given amount in the wallet

- Transfer a given amount between two wallets by withdrawing from one wallet and depositing that amount in another wallet

Picture of The Algoslingers
  Performance   Level  
Name: The Algoslingers <contact>
Classes: 9 packages by
Country: Ghana Ghana
Innovation award
Innovation award
Nominee: 5x

Winner: 1x

Instructions

Example Usage:

try {
    $walletA = new DigitalWallet(100);
    $walletB = new DigitalWallet(50);

    $walletA->deposit(30);
    $walletB->withdraw(20);

    echo "Wallet A Balance: " . $walletA->getBalance() . "<br>";
    echo "Wallet B Balance: " . $walletB->getBalance() . "<br>";

    $walletA->transfer($walletB, 25);

    echo "Wallet A Balance after transfer: " . $walletA->getBalance() . "<br>";
    echo "Wallet B Balance after transfer: " . $walletB->getBalance() . "<br>";
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
  Files folder image Files (1)  
File Role Description
Plain text file PHP-digital-wallet.php Class Main file

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:66
This week:0
All time:10,363
This week:89Up