johnbillion/args
johnbillion/args provides type-safe, documented array shapes for WordPress and PHP functions like WP_Query and wp_insert_post. It adds IDE autocompletion, static analysis support, and validation for complex argument arrays, reducing typos and runtime errors in WordPress plugin and theme code.
WP_Query, get_posts, get_terms, WP_User_Query, wp_insert_post, etc. with typed, discoverable arg objects. That directly informs a roadmap decision: do we keep accreting fragile array literals in every plugin, or adopt one shared, autocompleted contract?toArray()) is small enough that most agencies could write it, but the real cost is maintenance against WordPress core churn — new query args, deprecations, multisite nuances. Buying is the cheaper path unless you already have a platform team owning WP internals.meta_query/tax_query nesting has historically caused production incidents.Adopt when:
WP_Query-style APIs).Look elsewhere when:
spatie/laravel-data — those give you the same typing benefits with framework-native validation and serialization.For executives: This is a low-cost, low-risk developer-experience dependency for our WordPress work. It replaces error-prone array literals in database queries with typed objects, which measurably reduces a common class of production bugs — malformed meta and taxonomy queries — and shortens onboarding for contract developers. It is a small, GPL-licensed library that sits alongside WordPress core conventions rather than replacing them, so there is no lock-in: if the project stalls, we can fork or revert to plain arrays with minimal effort. Recommended decision: adopt as a standard dependency in Composer-managed WordPress projects, with a pinned version and a documented fallback.
For engineering: Typed arg objects for WP_Query, WP_Term_Query, WP_User_Query, and related APIs, with IDE autocompletion, static-analysis support, and a toArray() escape hatch at the boundary where WordPress core expects arrays. Adoption cost is one Composer line plus a style rule; migration can be incremental, file by file. Two caveats to plan around: (1) this is WordPress-specific — do not carry it into non-WP services; (2) it is a single-maintainer project on a recent release cadence, so pin the version, keep toArray() usage at the integration boundary so the dependency stays swappable, and avoid leaking arg objects into domain-layer signatures.
How can I help you explore Laravel packages today?