stoutlogic/acf-builder
Fluent builder for Advanced Custom Fields Pro (ACF) field groups. Define fields and locations in PHP, reuse configs, and generate ACF’s registration arrays with less boilerplate. Ideal for keeping ACF setup in version control.
getField (GroupBuilder) and getLayout (FlexibleContentBuilder) methods, along with the -> delimiter syntax for nested field manipulation, significantly improve flexibility for complex, hierarchical data structures (e.g., CMS layouts, multi-level configurations). This aligns well with Laravel’s Eloquent relationships but extends it to dynamic schemas, reducing the need for manual joins or nested queries.-> delimiter choice avoids breaking existing field names using . (e.g., field.name), preserving compatibility with legacy data. However, this may limit future flexibility if dot notation is later adopted.FlexibleContentBuilder improvements enable dynamic layouts (e.g., repeater fields with conditional logic), which is critical for headless CMS or admin panel use cases where content structure varies by use case.$builder->removeField('sections->hero->sub_title')) simplifies management of complex field groups, reducing boilerplate for:
acf_data JSON structures match the new delimiter syntax (e.g., {"sections": {"hero": {"sub_title": "..."}}}).$model->acf->sections->hero->sub_title) works as expected in templates/controllers.acf.built/acf.saving hooks can now target nested fields more granularly.Arrayable or JsonSerializable).-> syntax could conflict with:
acf_data JSON size, impacting storage/performance.sections->hero->sub_title) serialized/deserialized in acf_data? Is there a risk of data corruption if the JSON structure is malformed?. notation for nested fields? If so, what’s the deprecation timeline?.-delimited field names to -> syntax in acf_data?acf_data JSON structures for .-delimited field names (e.g., {"field.name": "value"}). Identify conflicts with the new -> syntax.Page, Product) for pilot testing.sections->hero).$model->acf->sections->hero->sub_title..-delimited fields with -> syntax in new field groups.is_legacy flag).acf_data JSON is valid for nested access.DB::statement() to update existing data if needed (e.g., UPDATE posts SET acf_data = JSON_REPLACE(acf_data, '$.field.name', '$.sections->hero->sub_title')).phpunit with RefreshDatabase and custom assertions for nested field access.FormRequest to validate nested fields (e.g., required('acf.sections->hero->sub_title')).HasAcf) to avoid breaking existing model methods.php artisan vendor:publish --provider="StoutLogic\AcfBuilder\AcfBuilderServiceProvider").config/acf.php to define nested field groups.sections->hero->sub_title).$builder->removeField('sections->hero->sub_title').HasAcf trait and access nested fields (e.g., $model->acf->sections->hero).return $model->acf->toArray()).FormRequest classes.How can I help you explore Laravel packages today?