Should I bind a Money value object to Eloquent with a custom cast or with accessors/mutators?
Integer cents in the DB, an immutable Money on the model: put the mapping in one CastsAttributes class and keep currency as a second column there.
Just Ask
Ask me anything about software architecture, careers, PHP, Go and the craft of building software; I answer here, in the open, for everyone. (Page 4/10)
The questions here are compiled from what I have run into in the field and from what people have asked me; I write the answers. No record carries the name of whoever asked.
Integer cents in the DB, an immutable Money on the model: put the mapping in one CastsAttributes class and keep currency as a second column there.
Default to list<Order> docblocks with strict PHPStan in CI; add one generic Collection<T> for behavior, a concrete class only at a trust boundary.
Turn the promotion into a concrete move: pick one fuzzy problem nobody owns and carry it end to end for a quarter, from its definition to its rollout.
Log at ERROR when the line would wake someone at 3am and at WARN when it would not, log a failure once at its boundary, and alert on the ERROR rate.
Define readiness, liveness and startup as Kubernetes probes; keep HEALTHCHECK only if the image also runs under Compose, pointing both at one endpoint.
Instrument usage per partner, publish a dated sunset with Sunset and Deprecation headers on every response, run brownouts, and cut when usage nears zero.
Run EXPLAIN (ANALYZE, BUFFERS) in production, then ANALYZE the table and check n_dead_tup; tune autovacuum per-table for sessions and add a partial index.
Export NumGoroutine() as a metric, take a pprof goroutine dump at peak, make the spawn site behind the parked stacks honor ctx.Done(), then add goleak.
Run it fully strict and throwing in local and CI; in production keep it on but wire handleLazyLoadingViolationUsing to log without failing the request.
Add a backed enum on the same integer values, use tryFrom() at the boundaries, and keep the old constants as deprecated aliases while you move call sites.