Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Balance

Laravel Balance Laravel Package

mreduar/laravel-balance

mreduar/laravel-balance adds balance and transaction tracking to Laravel Eloquent models. It provides a simple API for crediting and debiting accounts, recording balance history, and managing wallet-style ledgers for users, teams, or other models. Useful for credits, rewards, payments, and account b...

View on GitHub
Deep Wiki
Context7

mreduar/laravel-balance is a lightweight Laravel package for tracking balances on any Eloquent model. It provides a clean API to credit and debit amounts while recording every change as an auditable transaction, making it easy to build wallets, loyalty points, credits, or token systems.

  • Polymorphic balance support for any Eloquent model
  • Simple credit() / debit() API with atomic updates
  • Full transaction history for auditing
  • Configurable models and migrations
  • Laravel-native integration and easy setup
Frequently asked questions about Laravel Balance
How do I install mreduar/laravel-balance in a Laravel application?
Install it with Composer using composer require mreduar/laravel-balance, then follow the package README for any service provider, config publishing, or migration steps. Laravel package discovery may register the service provider automatically, but you should confirm the exact integration points in the package source. Run your migrations and application test suite in a sandbox branch before deploying. Check composer.json for the supported Laravel and PHP constraints.
Which Laravel and PHP versions are supported by laravel-balance?
Version 1.4.0 added support for the latest Laravel versions, but the release note does not publish a complete Laravel and PHP support matrix. You should inspect the package composer.json, README, changelog, and CI configuration to confirm current constraints. Do not assume that support for the latest Laravel release means your specific Laravel or PHP version is supported. Verify the matrix before adopting or upgrading.
Will mreduar/laravel-balance work with older Laravel versions?
The v1.4.0 release is described as adding support for the latest Laravel versions, which can also mean older Laravel or PHP versions were dropped. The release notes do not state whether Composer constraints changed, so compare the package constraints against your lockfile. If you are on an older Laravel release, confirm compatibility in a non-production branch before upgrading. Run your application tests and targeted balance checks in staging.
How do I increase or decrease a model's balance with laravel-balance?
The package exposes an expressive API for crediting and debiting Eloquent models, including increase and decrease operations. Balance changes are stored as movements so you retain a transaction history. Check the README for the exact method names and return values before wiring it into your domain logic. Validate behavior with tests around positive, zero, and insufficient balance scenarios.
Does laravel-balance keep a full transaction history of balance movements?
Yes. The package is designed to maintain a history of balance movements in your Eloquent models. That gives you an auditable record of credits, debits, resets, and balance sets instead of only storing a current total. You should still review how the history table is structured and whether it meets your audit or reporting requirements. Confirm retention and indexing needs for high-volume usage.
Are balance updates in mreduar/laravel-balance atomic and race-safe?
The package blurb advertises atomic, race-safe updates, which is important when multiple requests credit or debit the same model. Atomicity depends on the underlying database operations, transactions, and locking strategy, so review the source and test concurrent updates. Run a load or concurrency test against your database engine before using it for high-volume financial-style balances. Do not rely on the marketing description alone for production guarantees.
How can I check if a model has a positive balance or no balance?
The package provides checks for whether a model has a positive balance or no balance, in addition to setting and resetting balances. Review the README for the exact query methods and how they behave for zero, positive, and missing balance records. Add tests for edge cases such as a newly created model with no movements. Confirm whether the checks query the current balance or recalculate from history.
Can I reset or manually set a model's balance using laravel-balance?
Yes. The package supports resetting and setting a model's balance in addition to increasing and decreasing it. Manual sets are useful for corrections, migrations, or reconciliation jobs, but you should confirm whether those operations also create history records. Keep an audit trail if your application requires explainable balance changes. Test reset and set behavior against your existing data before rollout.
Is mreduar/laravel-balance actively maintained and safe for production?
It is a community Laravel package, and v1.4.0 is a compatibility maintenance release rather than a major feature release. That is a positive maintenance signal, but it does not prove long-term support or a complete CI matrix. Review release cadence, test coverage, license, and maintainer responsiveness before adopting it. Treat adoption as low-to-moderate risk and validate it in a sandbox and staging environment.
What are alternatives to mreduar/laravel-balance for tracking balances in Laravel?
Alternatives include building a small ledger table and service class yourself, using a broader Laravel wallet or accounting package, or applying event sourcing for complex financial domains. This package is a lightweight fit when you mainly need credit, debit, reset, set, and positive-or-zero balance checks on Eloquent models. Compare alternatives on atomicity, audit history, database support, and maintenance activity. For regulated or high-volume money movement, require stronger transactional guarantees and testing.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console