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 3w 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 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

2324d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17345775?v=4)[MagonxESP](/maintainers/MagonxESP)[@magonxesp](https://github.com/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

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k196.2M3.1k](/packages/composer-composer)[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[symfony/config

Helps you find, load, combine, autofill and validate configuration values of any kind

4.3k479.6M8.3k](/packages/symfony-config)[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M24.9k](/packages/friendsofphp-php-cs-fixer)[symfony/asset-mapper

Maps directories of assets &amp; makes them available in a public directory with versioned filenames.

1678.8M231](/packages/symfony-asset-mapper)[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k78.3k89](/packages/pocketmine-pocketmine-mp)

PHPackages © 2026

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