Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Acf Builder

Acf Builder Laravel Package

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.

View on GitHub
Deep Wiki
Context7

An Advanced Custom Field Configuration Builder

Frequently asked questions about Acf Builder
How do I define nested fields (e.g., repeater fields with sub-fields) in ACF Builder for Laravel?
Use the `getField()` and `getLayout()` methods on `GroupBuilder` and `FlexibleContentBuilder` with the `->` delimiter syntax. For example, `$builder->addRepeater('sections')->addField('title', 'text')->addField('content', 'wysiwyg')` creates a repeater with nested fields. The package handles serialization automatically, but ensure your `acf_data` JSON matches the new structure.
Is stoutlogic/acf-builder compatible with Laravel 10 and PHP 8.2+?
The package hasn’t been updated since 2021, so compatibility with Laravel 10 or PHP 8.2+ features (like enums) isn’t guaranteed. Test thoroughly, especially if using newer Laravel features. Check the GitHub issues for unresolved conflicts.
Can I migrate existing ACF field groups (using dot notation like `field.name`) to the new `->` syntax?
No built-in migration tool exists, but you can manually update field names in your `acf_data` JSON. Replace `field.name` with `field->name` and validate the structure. The package doesn’t provide a direct conversion utility, so test changes in a staging environment first.
How do I validate nested field values (e.g., required fields, max depth) in ACF Builder?
ACF Builder doesn’t enforce validation rules natively—those are handled by ACF Pro itself. Use ACF’s built-in validation (e.g., `validate_callback` in field definitions) or Laravel’s Form Requests to validate nested data before saving. For complex cases, consider custom logic in your model observers.
Will stoutlogic/acf-builder eventually support dot notation (e.g., `field.name`) alongside `->` syntax?
There’s no official roadmap for dot notation support, and the current `->` delimiter was chosen to avoid conflicts with legacy field names. If you need dot notation, consider alternatives like custom serialization or a wrapper package. The package prioritizes backward compatibility over new syntax.
How do I reuse ACF field groups across multiple Laravel projects or modules?
ACF Builder’s fluent API makes it easy to define reusable field groups in PHP. Store configurations in a shared Composer package or Laravel module, then include them via `require` or service providers. Ensure field keys (`key` in the ACF array) are unique to avoid conflicts.
Are there performance benchmarks for deeply nested fields (e.g., 10+ levels) in ACF Builder?
No official benchmarks exist, but deeply nested fields may increase serialization overhead and `acf_data` JSON size. Test with your expected data structure in a staging environment. For extreme cases, consider flattening nested fields or using a dedicated NoSQL solution like MongoDB via Laravel’s Eloquent.
How do I handle ACF field groups in Laravel Livewire or dynamic forms?
ACF Builder works seamlessly with Livewire. Define your fields in PHP, then access them in Livewire components via `$model->acf->field_name`. For dynamic forms, use the `FlexibleContentBuilder` to create conditional layouts. Ensure your Livewire properties match the ACF field structure.
What alternatives exist for managing ACF Pro fields in Laravel if ACF Builder lacks features?
Alternatives include raw PHP arrays (no builder), Laravel packages like `spatie/laravel-acf` (for Eloquent integration), or custom solutions using ACF’s JSON export/import. For advanced nested fields, consider a headless CMS like Strapi or direct database handling with Laravel’s JSON columns.
How do I test ACF Builder configurations in Laravel’s PHPUnit?
Mock the `acf_add_local_field_group` function and assert the built array structure. Use Laravel’s `expectsJob()` for testing field group registration. For nested fields, verify serialization/deserialization by comparing JSON outputs. Example: `assertEquals($expectedArray, $builder->build());`
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai