theodorejb/polycast
theodorejb/polycast brings type-safe casting to PHP: a simple Cast class converts values to int, float, bool, string, array, or DateTime, throwing clear exceptions when a value can't be cast instead of silently coercing it.
"12abc" → 12), turn null into 0, and lose precision on float→int. Standardizing on strict casts converts a whole category of production data bugs into loud, catchable exceptions — measurable through reduced data-integrity tickets and faster root-cause analysis.strict_types and static analysis; engineers get a drop-in replacement for native casts without a rewrite.0, scientific-notation strings parsing unexpectedly, decimals silently truncated.declare(strict_types=1) plus PHPStan/Psalm and wants one consistent, exception-based cast API rather than helpers invented per service.brick/math, moneyphp) — floats remain the wrong tool for currency.This is not a feature; it's a low-cost, low-risk hygiene decision that eliminates a recurring class of data bugs by making invalid conversions fail loudly instead of silently corrupting values. The cost is one small, permissively licensed dependency — or an afternoon of internal code — with no vendor, no infrastructure change, and no lock-in. To engineering: it's a tiny, dependency-free functional API for strict int/float/string casting that complements strict_types and static analysis and replaces scattered native casts at system boundaries. Be honest about the diligence caveat: adoption is thin, so plan to vendor or fork it and own the code rather than relying on upstream support. Recommended path: scoped pilot on a single ingestion path, measure integrity incidents, then decide on broader rollout.
How can I help you explore Laravel packages today?