php-stubs/acf-pro-stubs
PHP stubs for Advanced Custom Fields Pro, providing accurate function and class signatures so IDEs and static analysis tools like PHPStan and Psalm can offer autocompletion and type checking for ACF Pro APIs.
php-stubs/generator and check them into CI. Buying costs near-zero engineering time and tracks upstream; building costs roughly a day of setup plus regeneration on every ACF upgrade, but removes a third-party dependency and guarantees version parity. The decision hinges on how far your installed ACF version has drifted from the latest stub release.get_field()/the_field() return mixed, so they will not solve the field-value typing problem. Whether to invest in a thin typed accessor layer or generated field value objects is a real roadmap item this package surfaces rather than answers. Use the stub-only baseline to size the residual mixed problem before committing budget.Adopt when most of these hold:
require-dev package; if ACF Pro is vendored by hand or bundled inside a parent theme, the fit is poor.ignoreErrors blocks for ACF.acf_add_local_field_group(), get_field_object(), have_rows(), blocks and options-page APIs is the everyday payoff.Look elsewhere or defer when:
vendor/.get_field() returning mixed is not something a stub package can fix — evaluate a typed wrapper (custom accessors, generated DTOs, a field-class generator) instead.One line: a free, MIT-licensed, development-only type-definition package that teaches our static analyzer and IDE the shape of the Advanced Custom Fields Pro API — no runtime code, no production footprint.
To executives: This is a zero-cost, near-zero-risk lever on code quality for the ACF portions of our WordPress products. It changes nothing in production; it lets our tooling catch a recurring class of "undefined function" and "wrong arguments" bugs before merge, and it shortens onboarding for developers who don't know ACF's API by heart. The main risk is upstream maintenance — the project is small (74 stars, no registered dependents, though private agency repos typically aren't counted) — which we mitigate by pinning the version, keeping the integration to a single require-dev line plus a small analyzer config entry, and retaining the option to generate the stubs ourselves in about a day if the package stalls.
To engineering: Add php-stubs/acf-pro-stubs to require-dev and reference it via stubFiles/scanFiles in phpstan.neon, alongside php-stubs/wordpress-stubs. Expect immediate wins on undefined-function and parameter-count errors and IDE autocomplete across the ACF API. Be explicit about the boundary: this gives us signatures, not field types — get_field() stays mixed. If we want typed field access, that's a separate decision about a wrapper layer, and this baseline is exactly the data we need to scope it. Watch the version-parity caveat on ACF upgrades, and budget sibling stubs for any ACF add-ons we adopt.
How can I help you explore Laravel packages today?