ACF Chef#
ACF Chef is a fluent builder for declaring Advanced Custom Fields field groups in PHP. It is built on top of vinkla/extended-acf, so it uses extended-acf field classes and native field APIs rather than replacing them.
ACF itself accepts nested arrays. extended-acf gives those arrays an object API. ACF Chef adds a declaration tree around that API: fields use concise verbs, containers nest through closures, shared definitions compose into any container, and the field tree remains editable until it is compiled.
use AcfChef\Chef;
add_action('acf/init', function () {
Chef::group('hero', function ($group) {
$group
->text('title')
->image('background')
->location('post_type', 'page');
})->register();
});
What ACF Chef adds#
- Name-only field methods, with labels derived from field names.
- Closure-based nesting for groups, repeaters, flexible content and layouts.
- Reusable recipes and path-addressed edits before compilation.
- Readable, path-based field keys by default.
- Conditional references resolved against the complete field tree.
- Project-specific field types, macros and configuration shorthands registered without forking the package.
- Data migrations for the saved values a restructured field group would otherwise orphan.
ACF Chef compiles the finished tree into the array ACF expects. During compilation it creates the real extended-acf field objects, applies deferred native configuration, resolves cross-field references and generates the final keys.
Start here#
Read Why ACF Chef to compare it with raw ACF arrays and plain extended-acf.
Follow Getting started to install the package and put a field group on screen.
Read How it works for the describe-and-compile model behind the API.
Read Data migrations when a field group has to change after data has been saved under it.