Download the PHP package log1x/acf-composer without Composer

On this page you can find all versions of the php package log1x/acf-composer. 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 acf-composer

ACF Composer

Latest Stable Version Total Downloads Build Status

ACF Composer is the ultimate tool for creating fields, blocks, widgets, and option pages using ACF Builder alongside Sage 10.

Screenshot

Features

Requirements

Installation

Install via Composer:

Usage

Getting Started

Start by publishing the config/acf.php configuration file using Acorn:

Generating a Field Group

To create your first field group, start by running the following generator command from your theme directory:

This will create src/Fields/Example.php which is where you will create and manage your first field group.

Taking a glance at the generated Example.php stub, you will notice that it has a simple list configured.

Proceed by checking the Add Post for the field to ensure things are working as intended – and then get to work.

Generating a Field Partial

A field partial consists of a field group that can be re-used and/or added to existing field groups.

To start, let's generate a partial called ListItems that we can use in the Example field we generated above.

Looking at ListItems.php, you will see out of the box it consists of an identical list repeater as seen in your generated field.

A key difference to note compared to an ordinary field is the omitting of ->build() instead returning the FieldsBuilder instance itself.

This can be utilized in our Example field by passing the ::class constant to ->addPartial():

Generating a Block

Generating a block is generally the same as generating a field as seen above.

Start by creating the block field using Acorn:

You may also pass --construct to the command above to generate a stub with the block properties set within an attributes method. This can be useful for localization, etc.

When running the block generator, one difference to a generic field is an accompanied View is generated in the resources/views/blocks directory.

Like the field generator, the example block contains a simple list repeater and is working out of the box.

Block Preview View

While $block->preview is an option for conditionally modifying your block when shown in the editor, you may also render your block using a seperate view.

Simply duplicate your existing view prefixing it with preview- (e.g. preview-example.blade.php).

Generating a Widget

[!IMPORTANT] With WordPress 5.8, Blocks can now be used as widgets making this feature somewhat deprecated as you would just make a block instead.

If you are on the latest WordPress and would like to use the classic widget functionality from ACF Composer, you will need to opt-out of the widget block editor.

Creating a sidebar widget using ACF Composer is extremely easy. Widgets are automatically loaded and rendered with Blade, as well as registered with WP_Widget which is usually rather annoying.

Start by creating a widget using Acorn:

Similar to blocks, widgets are also accompanied by a view generated in resources/views/widgets.

Out of the box, the Example widget is ready to go and should appear in the backend.

Generating an Options Page

Creating an options page is similar to creating a regular field group in additional to a few configuration options available to customize the page (most of which, are optional.)

Start by creating an option page using Acorn:

Optionally, you may pass --full to the command above to generate a stub that contains additional configuration examples.

Once finished, you should see an Options page appear in the backend.

All fields registered will have their location automatically set to this page.

Caching Fields

Each time your application is ran, ACF Composer has to build your field groups into an array to register with ACF. In larger projects, it may be a good idea to cache the field groups into an array during deployment. This can be done using the acf:cache command:

Cache can then be cleared using the acf:clear command:

Custom Stub Generation

To customize the stubs generated by ACF Composer, you can easily publish the stubs directory using Acorn:

The publish command generates all available stubs by default. However, each stub file is optional. When a stub file doesn't exist in the stubs/acf-composer directory, the default stub provided by the package will be used.

Default Field Settings

One of my personal favorite features of ACF Composer is the ability to set field type as well as field group defaults. Any globally set default can of course be over-ridden by simply setting it on the individual field.

Global

Taking a look at config/acf.php, you will see a few pre-configured defaults:

When setting trueFalse and select to have their ui set to 1 by default, it is no longer necessary to repeatedly set 'ui' => 1 on your fields. This takes effect globally and can be overridden by simply setting a different value on a field.

Field Group

It is also possible to define defaults on individual field groups. This is done by simply defining $defaults in your field class.

My Defaults

Here are a couple defaults I personally use. Any prefixed with acfe_ are related to ACF Extended.

Bug Reports

If you discover a bug in ACF Composer, please open an issue.

Contributing

Contributing whether it be through PRs, reporting an issue, or suggesting an idea is encouraged and appreciated.

License

ACF Composer is provided under the MIT License.


All versions of acf-composer with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
stoutlogic/acf-builder Version ^1.11
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 log1x/acf-composer contains the following files

Loading the files please wait ....