Download the PHP package anthonypauwels/wp-acf-builder without Composer

On this page you can find all versions of the php package anthonypauwels/wp-acf-builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-acf-builder

WP ACF Builder

Create ACF fields with ease using a fluent API.

Requiring WordPress with Advanced Custom Fields Pro.

Installation

Require this package with composer.

Usage

Basic

The main Builder class provides shortcut methods to help you create your fields. Here is an example of creating fields for your home page template :

Builder class provides methods to build fields group for Posts Types, Options Pages and Page Template. Location group also provides helpers methods to show them using conditional parameters :

Group instances that can exports sub_fields provides helpers methods to create them. It concerns Group, Layout, Location and Repeater. These methods help you to create subfields like TextField, TextareaField, ImageField, etc. Each class has its own helpers to configure themselves.

For example, you can define how the value of an image field must be returned using helpers methods like returnUrl(), returnArray() or returnId()

Groups with subfields helpers can also create subgroups using the same way. A Location can use repeater($name, $closure) to create a repeater field on its own.

The helpers to create group (Repeater, Group, Layout) accept a closure with instance on parameter that provides the same API to configure fields.

Build

You can build your group separately using their method build.

Builder class provides a static method build() that accepts a closure as parameter. This method calls the closure first then create the acf/init action. Every group created inside the closure will be internally marked for build and built inside the WordPress action. Using that way, you do not need to call the build() method of each group, Builder will make it for you.

If you want to export your fields into a separate file, you can also require it into the closure :

Namespace

The static method Builder::namespace can be used to wrap many Builder::pageTemplate calls. A namespace is simply a directory where your templates is stored.

Reuse

Here is an example of creating a banner group with predefined fields. When your group is created, you can push them into the fields list of another groups like Location, Repeater and Layout.

Filters

Fields and groups provides helpers methods for ACF filters. For example, you can create a filter where the returned value is transformed into capital case.

Or pre-populated a repeater fields :

For more information about ACF filters, check the Advanced Custom Fields documentation about Filters.

Raw parameters

If you want to set an ACF parameters not available on the package, you can use the param method on fields. Imagine that you want to use WPML with your ACF fields, you can set a value to wpml_cf_preferences like this way :

Default configuration

Configure a default configuration to all fields can be long and daunting, so you can also use a config method on the Builder that accept an array as parameter.

The Builder has a bunch of new methods and constants to help to you to configure every field :

You must set default configuration before building fields because the configuration array are merged when build method is called.

API documentation

WP ACF Builder provides a fluent API for each instances available.

Builder

Subfields

Class Group, Location, Layout and Repeater use Subfields trait that provides the methods to create fields:

Flexible Content

Group

Layout Group

Location Group

Repeater Group

AbstractField

Every field inherit from AbstractField class that provide generic API. Example below works with all fields :

AccordionField

BooleanField

ButtonGroupField

CheckboxField

ColorField

DateField

DateTimeField

EmailField

FileField

GalleryField

GoogleMapField

ImageField

LinkField

MessageField

NumberField

OEmbedField

PageLinkField

PasswordField

PostObjectField

RadioField

RangeField

RelationshipField

SelectField

TabField

TaxonomyField

TextareaField

TextField

TimeField

UrlField

UserField

WysiwygField

Generic methods

Both fields and groups can use these methods:

Requirement

PHP 8.0 or above


All versions of wp-acf-builder with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package anthonypauwels/wp-acf-builder contains the following files

Loading the files please wait ....