PHPackages                             magonxesp/block-autoload - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. magonxesp/block-autoload

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

magonxesp/block-autoload
========================

Autoload wordpress blocks

v0.1-alpha(6y ago)08MITPHP

Since Feb 20Pushed 6y ago1 watchersCompare

[ Source](https://github.com/MagonxESP/block-autoload)[ Packagist](https://packagist.org/packages/magonxesp/block-autoload)[ RSS](/packages/magonxesp-block-autoload/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (3)Dependencies (4)Versions (3)Used By (0)

Block Autoload
==============

[](#block-autoload)

Simple block autoloader for define and autoload wordpress gutemberg blocks using OOP paradigm.

WARNING! This is currently in development and many upcoming features will include is not in the package. The usage documentation will be update for new development releases, or pre releases.

Getting started
---------------

[](#getting-started)

### Setting up composer

[](#setting-up-composer)

NOTE: Skip this step is not required if you have a composer based wordpress instalation or you have composer in your theme.

- Initialize composer in your current theme

    ```
    $ cd wp-content/themes/current-theme
    $ composer init
    ```
- Require composer autoloader for autoload composer dependencies at the first line of functions.php

    ```
    require_once 'vendor/autoload.php';
    ```

### Instalation and usage

[](#instalation-and-usage)

Install the library using composer

```
$ composer require magonxesp/block-autoload
```

#### Creating the blocks directory and your first block structure

[](#creating-the-blocks-directory-and-your-first-block-structure)

Create the block directory in your theme

```
$ mkdir blocks
```

Inside the blocks directory create your first block example

```
$ cd blocks
$ mkdir example
$ touch example/Example.php # the block class
$ touch example/example.template.php # the block template
```

Define the example block class

```
// example/Example.php
namespace YourThemeNamespace\Blocks;

use MagonxESP\BlockAutoload\Annotation\Block;
use MagonxESP\BlockAutoload\Block\BlockBase;

/**
 * Class Example
 *
 * @Block(
 *     name="example",
 *     title="Example",
 *     description="Example block",
 *     icon="",
 *     domain="my-site",
 *     category="custom",
 *     keywords={"keyword1", "keyword2"},
 *     template="example.template.php"
 * )
 */
class Example extends BlockBase {

    public $hello;

    public function setup() {
        $this->hello = 'Hello wordpress';
    }
}
```

Adding content to the template, and use defined `$context` variable for access to block class public properties

```

```

#### Autoloading blocks by the ACF PRO plugin block API

[](#autoloading-blocks-by-the-acf-pro-plugin-block-api)

```
// functions.php
use MagonxESP\BlockAutoload\BlockAutoload;
use MagonxESP\BlockAutoload\Block\BlockPlugin;

add_action('init', function() {
    // autoload blocks registering them using the ACF PRO Block API (Require ACF PRO plugin installed and activated)
    $block_autoloader = new BlockAutoload(BlockPlugin::ACF_PRO, __DIR__ . '/blocks');
    $block_autoloader->setBlockNamespace('YourThemeNamespace\\Blocks\\');
    $block_autoloader->load();
});
```

Upcoming features
-----------------

[](#upcoming-features)

- Using block class properties as template variables
- Compatibility with the wordpress block api (defined in current version but does nothing)
- Compatibility with Twig templates (using Timber plugin)
- Possibility to alter the render output with wordpress filters

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2275d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ee716bcff8cc340212662f56b5f1b5d73d64e753a1de57a73fdccb043d8a4532?d=identicon)[MagonxESP](/maintainers/MagonxESP)

---

Top Contributors

[![magonxesp](https://avatars.githubusercontent.com/u/17345775?v=4)](https://github.com/magonxesp "magonxesp (41 commits)")

---

Tags

composer-packagegutembergoopwordpresswordpress-php-library

### Embed Badge

![Health badge](/badges/magonxesp-block-autoload/health.svg)

```
[![Health](https://phpackages.com/badges/magonxesp-block-autoload/health.svg)](https://phpackages.com/packages/magonxesp-block-autoload)
```

###  Alternatives

[phpro/soap-client

A general purpose SoapClient library

8885.6M46](/packages/phpro-soap-client)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k74.6k86](/packages/pocketmine-pocketmine-mp)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

96374.6k23](/packages/friendsoftypo3-content-blocks)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[shyim/danger-php

Port of danger to PHP

8544.9k](/packages/shyim-danger-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
