PHPackages                             micropackage/block-loader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. micropackage/block-loader

ActiveLibrary[Templating &amp; Views](/categories/templating)

micropackage/block-loader
=========================

Block Loader - automatic Gutenberg blocks from template files.

1.0.7(1y ago)2326.3k↓37.5%6[3 issues](https://github.com/micropackage/block-loader/issues)GPL-3.0-or-laterPHPPHP &gt;=5.6

Since Jan 30Pushed 1y ago3 watchersCompare

[ Source](https://github.com/micropackage/block-loader)[ Packagist](https://packagist.org/packages/micropackage/block-loader)[ RSS](/packages/micropackage-block-loader/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (5)Dependencies (6)Versions (10)Used By (0)

Block Loader
============

[](#block-loader)

[![BracketSpace Micropackage](https://camo.githubusercontent.com/7a9f5ff780f859fdebce60d4e11572de05f86c42ef96b77967c24d7ea7d1e04b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f427261636b657453706163652d4d6963726f7061636b6167652d627269676874677265656e)](https://bracketspace.com)[![Latest Stable Version](https://camo.githubusercontent.com/d524490a8c06fc535f54a97b74a43c06c45e49992e4bc553590831fe87165157/68747470733a2f2f706f7365722e707567782e6f72672f6d6963726f7061636b6167652f626c6f636b2d6c6f616465722f762f737461626c65)](https://packagist.org/packages/micropackage/block-loader)[![PHP from Packagist](https://camo.githubusercontent.com/e00b9acc8d0be18cd9335d0e8de2110192b3c6cad380b01d2638e09daafba330/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d6963726f7061636b6167652f626c6f636b2d6c6f616465722e737667)](https://packagist.org/packages/micropackage/block-loader)[![Total Downloads](https://camo.githubusercontent.com/a98b0965a88fac8288a524449827c70dbe1abfc5a5c5f9828a93014d804bc742/68747470733a2f2f706f7365722e707567782e6f72672f6d6963726f7061636b6167652f626c6f636b2d6c6f616465722f646f776e6c6f616473)](https://packagist.org/packages/micropackage/block-loader)[![License](https://camo.githubusercontent.com/0dc78a8e2fd20fe203798e01e3788bb3dd7201eefb1c1a36c35b785e5d6b771c/68747470733a2f2f706f7365722e707567782e6f72672f6d6963726f7061636b6167652f626c6f636b2d6c6f616465722f6c6963656e7365)](https://packagist.org/packages/micropackage/block-loader)

 [![Micropackage logo](https://camo.githubusercontent.com/9b9fc4f221b3683db4f9cc63e1ed92220004bbda118206d0a26d5ce6377d4d46/68747470733a2f2f627261636b657473706163652e636f6d2f6578747261732f6d6963726f7061636b6167652f6d6963726f7061636b6167652d736d616c6c2e706e67)](https://camo.githubusercontent.com/9b9fc4f221b3683db4f9cc63e1ed92220004bbda118206d0a26d5ce6377d4d46/68747470733a2f2f627261636b657473706163652e636f6d2f6578747261732f6d6963726f7061636b6167652f6d6963726f7061636b6167652d736d616c6c2e706e67)

Requires WordPress &gt;=5.8.0.

🧬 About Block Loader
--------------------

[](#-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:

```
acf_register_block_type( [
	'name'              => 'sample-block',
	'title'             => __('Sample Block'),
	'render_template'   => 'blocks/sample-block.php',
] );
```

You can do initialize the loader once:

```
Micropackage\BlockLoader\BlockLoader::init( [
	'dir' => 'blocks',
] );
```

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

```
