3neti/instruction
A lightweight Laravel package for defining, organizing, and executing reusable instructions through a clean, expressive API. Reduce duplication, keep logic readable, and integrate seamlessly into any PHP or Laravel application.
Architecture fit
The package has matured from a simple pricing helper into a layered financial subsystem: models for wallet-backed persistence, services encapsulating the pricing engine, and DTOs for serialization. That separation of concerns is a meaningful architectural improvement and makes the package easier to reason about, test, and extend. The adoption of Brick Money plus integer minor units aligns the package with standard financial-software practice (no floating-point arithmetic on money), which is the single most important technical signal in this release.
The wallet integration (Bavix Laravel Wallet) is the most consequential architectural decision. It couples the package to an external domain package with its own schema, migrations, and transactional semantics. For teams already running Bavix, this is a natural fit; for teams using a different ledger, cashier, or custom accounting model, the wallet-enabled instruction items will either be dead weight or require an adapter layer.
Integration feasibility
Feasible for Laravel applications on modern PHP versions, assuming Bavix and Brick Money are compatible with the host framework version. Feasibility is highest for greenfield or pre-production integrations and lowest for systems already persisting float prices. The breaking change to price typing ('5.00' string or 500 integer, floats rejected) will surface immediately at write boundaries and is the main integration cost.
The dual representation (price/price_minor, total_amount/total_amount_minor) is a good API ergonomic choice but carries a consistency obligation: both fields must always be derived from a single source of truth. Consumers must be told which field is authoritative for reconciliation (the minor-unit field) and which is presentational.
Technical risk
price as a numeric.Key questions
price_minor / total_amount_minor — and is the decimal field guaranteed to be a pure projection?Stack fit
Best fit is a Laravel application already using Bavix Laravel Wallet, or one willing to adopt it as the ledger. Teams with an existing financial ledger (Stripe, a custom double-entry system, or a different wallet package) should evaluate whether wallet-enabled instruction items add value or create a second source of revenue truth. Brick Money is a low-risk addition — it is narrowly scoped, well-maintained, and replaces ad hoc float math.
Migration path
Treat this as a schema and data migration, not a library bump.
price / total_amount, including seeders, factories, imports, jobs, and API consumers.*_minor for computation; keep decimal fields for display only.Compatibility
price; consumers performing arithmetic on the decimal field must be audited.Sequencing
Run this in a dedicated change window rather than bundling with feature work. Order: dependency compatibility check → schema addition → backfill and reconciliation → code cutover → API consumer updates → legacy column removal. Price history and wallet revenue tracking should be enabled only after the money contract is stable, so that any drift is attributable to a single change.
Maintenance
Ongoing maintenance load increases: two external dependencies now influence correctness, and the package is pre-1.0 with an active breaking-change cadence. Budget for reviewing each release rather than auto-updating. Price history adds a growing table that will need indexing and eventual archival.
Support
Support burden concentrates in two areas: money-format errors from callers still sending floats, and reconciliation discrepancies between item state and wallet ledger. Both are diagnosable if logging captures the minor-unit values and the transaction identifier. Publish an internal runbook for "totals do not match" before go-live, not after.
Scaling
Integer minor units scale well and avoid the precision drift that would otherwise compound across large volumes. The likely scaling constraints are the wallet ledger write path (row contention on hot wallet records) and price-history growth. Both are addressable with standard techniques — batching, queueing non-critical writes, partitioning history — but should be load-tested at expected order volume rather than assumed.
Failure modes
5.0 and storing it as 5 minor units instead of 500 — a 100x error.price as numeric after it becomes a decimal string.Mitigations: strict validation rejecting floats explicitly, transactional wrapping of item-plus-wallet writes, reconciliation checks in CI or scheduled jobs, and contract tests on the API payload shape.
Ramp-up
Moderate. The layered architecture (models/services/DTOs) is learnable, and the README now documents money rules, wallet integration, and design principles — a genuine improvement over typical pre-1.0 packages. The real ramp-up cost is conceptual: engineers must internalize the minor-unit-as-truth rule and stop reasoning in decimals. Plan a short internal walkthrough plus a written convention note, and enforce it in code review. New contributors should be able to ship a pricing change without touching wallet internals; if they cannot, the separation of concerns is not yet delivering its promised value.
How can I help you explore Laravel packages today?