Download the PHP package eidolex/e-wallet without Composer

On this page you can find all versions of the php package eidolex/e-wallet. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package e-wallet

Eidolex E-Wallet

A Laravel package for managing wallets, transfers, and transactions. Attach a wallet to any Eloquent model with a simple trait and start processing top-ups, withdrawals, and peer-to-peer transfers.

Requirements

Installation

Add the package to your composer.json repositories (local path or VCS), then require it:

The service provider is auto-discovered via composer.json extra config.

Run the migrations:

Optionally publish the config and migrations:

Setup

Add the HasWallet trait and HasWalletContract interface to any Eloquent model:

This gives the model access to wallet(), transactions(), deposit), withdraw(), and transfer(). To use your own Wallet, Transaction, or Transfer models, see Custom models.

Usage

Top Up

Add funds to a wallet. The wallet is automatically created on first use.

You can pass a custom DTO that extends DepositData (e.g. to add fees, computed metadata, or opening/closing balance). See Custom DepositData for an example.

Withdraw

Deduct funds from a wallet.

You can pass a custom DTO that extends WithdrawData and overrides fields(Wallet $wallet). See Custom DepositData for the same pattern.

Transfer

Move funds between two wallet holders. Creates a withdrawal transaction for the sender and a deposit transaction for the receiver, linked by a Transfer record.

You can pass a custom DTO that extends TransferData and overrides fromFields(Wallet $wallet) and toFields(Wallet $wallet). See Custom DepositData for the same pattern.

Accessing the Wallet & Transactions

Transaction Statuses

Balance is only updated when a transaction's status is Completed. Use Pending to record a transaction without affecting the balance.

Data Transfer Objects

All operations use Spatie Laravel Data DTOs. The name parameter accepts any UnitEnum, so you can use the built-in TransactionName or your own enum. Transaction attributes are built from each DTO: DepositData and WithdrawData expose fields(Wallet $wallet), and TransferData exposes fromFields(Wallet $wallet) and toFields(Wallet $wallet). Extend the DTO classes and override these methods if you need custom transaction data (e.g. computed metadata or balances).

DTO Parameters
DepositData name (UnitEnum), amount (int), status (TransactionStatus = Completed), metadata (?array)
WithdrawData name (UnitEnum), amount (int), status (TransactionStatus = Completed), metadata (?array)
TransferData to (HasWalletContract), name (UnitEnum), amount (int), fromMetadata (?array), toMetadata (?array)

Customization

Custom Transaction Name Enum

By default, transaction names use Eidolex\EWallet\Enums\TransactionName which provides: TopUp, Withdraw, Gift, and Purchase.

To use your own enum, create it and update the config:

Then pass your enum when creating transactions:

Custom Transaction Status Enum

Similarly, you can replace the default TransactionStatus enum:

Custom Metadata Cast

The metadata column is cast to array by default. You can change this in the config:

Custom DepositData

Extend DepositData and override fields(Wallet $wallet) when you need custom transaction attributes (e.g. computed metadata, fees, or opening/closing balance).

Usage:

The same pattern applies to WithdrawData (override fields(Wallet $wallet)) and TransferData (override fromFields(Wallet $wallet) and toFields(Wallet $wallet)).

Configuration Reference

Custom Models

You can swap the package models with your own by extending the base classes and registering them in config. Use this when you need a custom table, extra attributes, or app-specific methods.

1. Extend the package model (e.g. custom Wallet):

2. Register in config:

3. Add the trait with matching generics so static analysis and IDE know the correct types:

Trait generic order: TName, WalletModel, TransactionModel, TransferModel. Omit or keep defaults for models you do not customize. If you only use a custom Wallet:

Database Schema

The package creates three tables:

wallets — One wallet per owner (polymorphic). Unique on (owner_type, owner_id).

Column Type
id UUID (primary)
owner_type string
owner_id string
balance unsigned big integer (default: 0)
created_at timestamp
updated_at timestamp

transactions — Individual debit/credit records.

Column Type
id UUID (primary)
wallet_id UUID (foreign key)
type unsigned tiny integer (enum: 0 = Withdraw, 1 = Deposit)
name string (configurable enum)
amount unsigned big integer
status unsigned tiny integer (enum: Pending, Completed, Cancelled, Failed, Refunded)
opening_balance unsigned big integer (nullable)
closing_balance unsigned big integer (nullable)
metadata JSON (nullable)
created_at timestamp
updated_at timestamp

transfers — Links two transactions (sender and receiver).

Column Type
id UUID (primary)
from_transaction_id UUID (foreign key, cascade delete)
to_transaction_id UUID (foreign key, cascade delete)
amount unsigned big integer
metadata JSON (nullable)
created_at timestamp
updated_at timestamp

Transaction Safety

All wallet operations (topUp, withdraw, transfer) are wrapped in DB::transaction() so each operation is atomic.

License

MIT


All versions of e-wallet with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/database Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
spatie/laravel-data Version ^3.0|^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eidolex/e-wallet contains the following files

Loading the files please wait ...