- What is roundly-consulting/credits-for-laravel used for?
- It adds credit balances and ledger-style transactions to any Eloquent model in a Laravel application. You can attach credit accounts polymorphically, record credit and debit transactions with metadata, and query current balances and transaction history. The package is designed to keep credit logic independent of a specific billing provider.
- How do I install credits-for-laravel in a Laravel app?
- Install it with Composer using composer require roundly-consulting/credits-for-laravel. The package follows Laravel conventions and package auto-discovery is expected, but confirm whether a service provider is auto-registered and whether config publishing is required. Run any package migrations if provided, then attach a credit account to the model that should hold credits.
- Does credits-for-laravel support Laravel 10, 11, or 12?
- The available release note does not state an explicit Laravel version window. Version 1.1.2 raises minimum constraints on roundly/package-toolkit to ^1.3.0 and roundly/money to ^1.0.1, which can raise the effective PHP and Laravel floor. Check those dependencies' requirements against your platform before upgrading rather than assuming support from the package name alone.
- How do I attach a credit account to a User or other Eloquent model?
- The package uses polymorphic relationships, so a credit account can be attached to any Eloquent model rather than only a User model. You add the relationship on your model and create the account through the package's API. Confirm the exact trait or method names in the package source or README before implementing.
- How do I award credits or deduct credits from a balance?
- The package provides APIs to record credit and debit transactions against a credit account. Each transaction is written to the ledger and contributes to the current balance query. Use metadata to capture the reason, source, or external reference for each award or deduction.
- Can I store metadata on credit transactions?
- Yes, the package overview states that credit and debit transactions can be recorded with metadata. That is useful for audit context such as order IDs, reasons, or source systems. Treat metadata as application-defined and avoid storing sensitive data unless your storage and access controls are appropriate.
- How do I query a model's current credit balance and transaction history?
- You query the credit account attached to the model for its current balance and transaction history. The package is built around Eloquent, so expect relationship and query builder access rather than a separate storage engine. Confirm the exact balance method and history relationship names in the package documentation.
- Is there an auditable ledger, and can I reconcile balances?
- Yes, the design is ledger-style, with credit and debit transactions recorded and current balances available for querying. That supports reconciliation and audit review. For production use, verify how the package handles reversals, corrections, and concurrent writes before relying on it for financial-grade accounting.
- What are the dependencies and production risks of credits-for-laravel?
- Version 1.1.2 depends on roundly/package-toolkit ^1.3.0 and roundly/money ^1.0.1, while the testing dependency is development-only. The main risk is that a toolkit patch can raise PHP or Laravel minimums, and money patch releases can affect rounding or currency edge cases. Run composer update with --with-dependencies, diff composer.lock, and regression-test currency outputs.
- Is credits-for-laravel production-ready and actively maintained?
- The package is a conventional Laravel and Composer package with no queues, external services, or storage engines implied, so runtime risk is low. However, the 1.1.2 release note is a maintenance release and no changelog for 1.1.0 or 1.1.1 was available in the assessment. Validate the maintainer support policy, CI matrix, and test coverage before committing to it for critical credit balances.