chrisharrison/php-array-of
A lightweight PHP helper for creating and working with typed “array of” value collections. Simplifies validation/coercion so arrays contain only the expected item type, improving safety and readability for DTOs, configs, and API payload handling.
User[] collections in business logic).array_filter/instanceof checks in legacy code.Adopt when:
Look elsewhere if:
For Executives:
"This package lets us enforce strict data types in arrays (e.g., ensuring an API endpoint only accepts User[] objects) with minimal overhead. It reduces runtime errors from invalid data, improves code clarity, and avoids reinventing validation wheels—saving dev time and cutting tech debt. Think of it as a lightweight guardrail for our data pipelines."
For Engineering:
"Need to validate arrays of Product objects or integers without pulling in Symfony? php-array-of gives us a simple, dependency-light way to enforce types at creation time (e.g., ArrayOf::of(Product::class)->validate($input)). It’s faster to implement than manual checks and integrates cleanly with Laravel’s ecosystem. Perfect for DTOs, domain services, or input sanitization where we want to fail early and loud."
Key Selling Points:
foreach/instanceof loops with declarative syntax.How can I help you explore Laravel packages today?