Download the PHP package ars/laravel-cashier without Composer
On this page you can find all versions of the php package ars/laravel-cashier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ars/laravel-cashier
More information about ars/laravel-cashier
Files in ars/laravel-cashier
Package laravel-cashier
Short Description A powerful package for Laravel that facilitates seamless management of virtual currency, transaction handling, balance management, and fund transfers within your applications.
License MIT
Homepage https://github.com/alireza2000sajedi/laravel-cashier
Informations about the package laravel-cashier
Laravel Cashier Wallet Package
A powerful package for Laravel that facilitates seamless management of virtual currency, transaction handling, balance management, and fund transfers within your applications.
Features
- Wallet Management: Create and manage wallets associated with users or other entities.
- Payment Handling: Manage payments, including initiation, processing, and transaction logging.
- Transaction Management: Record and track all wallet-related transactions, including deposits and withdrawals.
- Configurable Withdraw Ceiling: Set a ceiling limit for withdrawals through configuration.
Requirements:
- Laravel Version: 10 or higher
- PHP Version: 8.0 or higher
Installation
To install the package, use Composer:
After installation, publish the configuration and migration files:
Then, run the migrations:
Configuration
The package comes with a configuration file located at config/cashier.php
. Key configuration options include:
wallet.ceiling_withdraw
: The default withdrawal ceiling.tables
: Customizable table names for wallets, payments, and transactions.
Usage
Traits
HasWallet
Add the HasWallet
trait to any model that should have a wallet:
-
Get Balance: Retrieve the wallet balance with:
-
Deposit:
This will increase the user’s wallet balance by 100 and log the transaction.
-
Withdraw:
This will decrease the user’s wallet balance by 50, if within the allowable ceiling, and log the transaction.
- Check Withdraw Capability:
HasPay
Add the HasPay
trait to any model that should handle payments:
-
Initiate Payment:
This starts a payment process and logs it as a transaction.
-
Process Payment Result:
This updates the payment details and marks the associated transaction as accepted.
-
Access Payment Transaction:
You can access the transaction associated with a specific payment.
Wallet Model
The Wallet
model manages user balances and transactions.
-
Get All Transactions:
-
Set Custom Withdrawal Ceiling:
You can dynamically adjust the ceiling for withdrawals on a specific wallet.
Payment Model
The Payment
model handles payment processing and recording.
-
Retrieve Payment by Authority:
This retrieves a payment record based on its authority code.
-
Update Payment Status:
This updates the status of a payment, which can be useful in payment processing callbacks.
License
This package is open-sourced software licensed under the MIT license.
Contributing
Contributions are welcome! Please submit a pull request or create an issue for any improvements or suggestions.
Support
For any issues, please visit the Issues page.