Download the PHP package codelight/acf-blocks without Composer

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

ACF Blocks

ACF Blocks is a lightweight library that provides a clean, object-oriented API to create and render ACF field groups.

Your WordPress code base doesn't have to be a mess.

This library is in beta. Use at your own risk. Contributions are welcome.

Overview

ACF Blocks introduces the concept of blocks, which are essentially Controllers (or actually ViewModels) for field groups and flexible layouts. Fields are created using the excellent ACF Builder library.

The three main benefits of using ACF blocks are:

Installation

If you're still not using Composer in 2018, then do yourself a huge favor and get started now. [todo: article]

Example 1: Quick procedural blocks

As an example, let's go through creating and rendering a simple field group.

Example 2: Encapsulate the block in a class

Let's create the same block in a much cleaner way - as a class. This class should be in a separate file called ImageBlock.php. You'll probably want to keep it in a separate folder, which you might want to call 'blocks'.

We'll also need to register the block we just created. This goes into your functions.php (or equivalent):

And that's it. You'll also need to add the templates as in the previous example.

Example 3: Setting up flexible layouts

Let's continue the previous example, but register the ImageBlock as a Flexible Content layout.
First, we'll need to create the Flexible Content block which will contain our ImageBlock.

This flexible content block works exactly as any other block. To register it, modify the code you previously added to your functions.php (or equivalent) as follows:

Now, you will have a flexible content area on every Page where you can add the ImageBlock. Note that the ImageBlock will still be added to template-image.php as a regular (non-flexible-layout) block as well. The ImageBlock will use the same template in both cases. This provides an easy way to re-use blocks between templates, flexible content areas and even projects. It's also possible to use a different template in different situations (e.g. flexible layout vs regular page context), whilst keeping the backend code of the block the same.

Example 4: So why is this useful?

One obvious answer is that once you get the general idea, it's about 10x faster compared to writing all the annoying template code by hand. However, the actual main advantage of using ACF Blocks is that it makes you architect things in one specific, clean, flexible and modular way. You now have a really good way to separate your templates and functionality. You can re-use and extend ACF field groups and blocks. You always know where to find your code. This approach speeds up the development of smaller projects but it really shines in the context of massive sites where you have lots of different fields and field groups.

todo: add more complex examples.

FAQ

Will using this library have an impact on performance?
No, it's just a really thin layer of abstraction. It doesn't do much, it just allows you to write better code.

I'm using soberwp/controller which already provides me with a Controller. Why should I use this library?
The concept behind soberwp/controller is great, but it doesn't have much use in the context of flexible layouts.


All versions of acf-blocks with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
stoutlogic/acf-builder Version *
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 codelight/acf-blocks contains the following files

Loading the files please wait ....