Download the PHP package micropackage/block-loader without Composer

On this page you can find all versions of the php package micropackage/block-loader. 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 block-loader

Block Loader

BracketSpace Micropackage Latest Stable Version PHP from Packagist Total Downloads License

Micropackage logo

Requires WordPress >=5.8.0.

🧬 About Block Loader

Block Loader loads the Gutenberg Block configuration directly out of the block template file. It parses the file header comment figuring out hwo to register the Block.

Basically instead doing this:

You can do initialize the loader once:

And define the block config directly in the template (blocks/sample-block.php):

Supported plugins:


This micropackage is compatible with ACF Block Creator which can create the block templates for you while defining the Field group for your new block.

💾 Installation

🕹 Usage

Before you can start creating blocks you need to initiate the block loader passing optional config array:

Blocks are based on the template files located by default in blocks folder in your theme (you can change that).

There are two steps to create a block:

  1. Create block template file in the blocks folder
  2. Define custom fields for your block using ACF or Meta Box.

Block template file needs to have a comment header containing block parameters.

ACF

Creating template files is enough for ACF to register blocks. After that you only need to create new fields group and set it's location to your custom block.

Meta Box

In Meta Box you need "MB Blocks" extension to work with blocks. With this plugin custom fields are defined in code. You need to use rwmb_meta_boxes filter to create metabox for your block.

Let's say you have a template called blocks/some-block.php. You need to add the fields definition like this:

All block parameters will be fetched from template header comment and merged with your fields configuration.

⚙️ Configuration

All parameters are optional.

Parameter Type Description
dir (string) This is a directory within your theme where block templates are located. Relative path.
Default: 'blocks'
categories (array) Array of custom block categories passed directly to block_categories_all filter.
If only one category will be configured, it will be used as default category for all custom blocks.
Default: [] (empty array)
wrap (false|string) Wrapper to each block. If set to false, the block content will be just the template file content.
Works only for ACF due to the differences in block rendering mechanisms.
Default: '<div id="%3$s" class="%2$s">%1$s</div>'
...$block_creator_params - Additional parameters passed to ACF Block Creator

Categories definition

This is how to define the categories array.

Wrap template

Parameters used in internal sprintf:

  1. block content from template file, which should be wrapped
  2. block classes string
  3. unique block id

Example: '<div id="%3$s" class="%2$s">%1$s</div>'

📦 About the Micropackage project

Micropackages - as the name suggests - are micro packages with a tiny bit of reusable code, helpful particularly in WordPress development.

The aim is to have multiple packages which can be put together to create something bigger by defining only the structure.

Micropackages are maintained by BracketSpace.

📖 Changelog

See the changelog file.

📃 License

GNU General Public License (GPL) v3.0. See the LICENSE file for more information.

© Credits

The Loader engine is based on the palmiak's Timber ACF WP Blocks.


All versions of block-loader with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
micropackage/singleton Version ^1.1
micropackage/dochooks Version ^1.0
micropackage/filesystem Version ^1.1
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 micropackage/block-loader contains the following files

Loading the files please wait ....