flying/struct
flying/struct lets PHP and Laravel projects define typed, immutable data structures: declare fields once; hydrate them from arrays or requests, validate values, and convert back to arrays or JSON. Lightweight, framework-friendly, and easy to drop into existing codebases.
Consider it when:
Int/String to Integer/Str is understood and all existing annotations/properties can be updated.Look elsewhere when:
For executives: This is a small PHP struct library. Release 0.3.0 contains no new functionality—it cleans up compatibility and introduces a breaking rename (Int to Integer, String to Str) because the old names are invalid in PHP 7. It also reports significantly faster struct creation on PHP 7.1 compared with PHP 5.6. The library is still pre-1.0, so adopting it now carries API-churn and maintenance risk. Recommendation: do not make it a strategic dependency; permit only a limited pilot if a concrete need for lightweight typed structures is proven, and otherwise rely on native PHP/Laravel capabilities or a more mature DTO package.
For engineering: Treat 0.3.0 as a migration release, not an upgrade with new capabilities. Any existing use of Int or String properties and annotations must be renamed to Integer and Str. Verify runtime compatibility with our current PHP and Laravel versions before adoption—the release notes frame compatibility around PHP 5.6/7.1, while modern Laravel requires PHP 8.1+. Re-run performance benchmarks in our environment rather than relying on the 50x claim, which is relative to PHP 5.6. If adopted, pin the version and isolate usage behind an internal interface to reduce future BC-break impact.
How can I help you explore Laravel packages today?