stephenjude/laravel-wallet
A Laravel wallet package for adding balances and transactions to any model. Create multiple wallets, deposit, withdraw, transfer funds, and track transaction history with a clean, simple API.
Architecture fit
HasWallet trait on the owner model plus Wallet and Transaction models. This maps cleanly onto a standard Laravel domain model (User/Team/Account owns one or more wallets), so it slots into an existing app without introducing a new service, queue, or datastore.Integration feasibility
composer require, publish config and migrations, run migrations, add the trait, create a wallet, call deposit/withdraw/transfer. A mid-level Laravel developer can produce a working proof of concept in under a day.Technical risk
lockForUpdate (or equivalent) inside a DB transaction for every balance-mutating path. If the package does not do this consistently, concurrent withdrawals can overdraw. This is the single highest-severity item to verify before adoption.deposit has no idempotency key or unique reference constraint, duplicate credits are a near-certainty in production.bcmath throughout, and that rounding is applied once at the boundary. Float arithmetic anywhere in the money path is a disqualifier.Key questions
bcmath — and where does rounding occur?transfer guarantee atomicity across both wallets, and does it deadlock-proof the lock ordering?Stack fit
Migration path
WalletService contract (credit, debit, transfer, balance, hold) and implement it with this package. Every call site depends on our interface, not on the vendor models. This is the decision that makes the rest reversible.users, run a one-time idempotent backfill that creates a wallet per owner and seeds an opening-balance transaction, then freeze the legacy column behind read-only access until cutover is verified.Compatibility
Sequencing
WalletService with idempotency enforced by us — a unique index on (wallet_id, idempotency_key) regardless of what the package offers.Maintenance
Support
Scaling
(wallet_id, created_at) and a partitioning or archival strategy from day one — retrofitting this on a large table is painful.Failure modes
Ramp-up
How can I help you explore Laravel packages today?