PHPackages                             tkotosz/block-decorator-magento2 - 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. tkotosz/block-decorator-magento2

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

tkotosz/block-decorator-magento2
================================

Tkotosz - Block Decorator module for Magento 2

1.0.2(7y ago)024.4kMITPHPPHP &gt;=7.1

Since Apr 2Pushed 7y agoCompare

[ Source](https://github.com/tkotosz/block-decorator-magento2)[ Packagist](https://packagist.org/packages/tkotosz/block-decorator-magento2)[ RSS](/packages/tkotosz-block-decorator-magento2/feed)WikiDiscussions master Synced 2mo ago

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

BlockDecorator module for Magento 2
===================================

[](#blockdecorator-module-for-magento-2)

[![License](https://camo.githubusercontent.com/f08035f263bad8d448d2bd11d310fb46d3c2cf1ff70c6a9a46791d727ca2d168/68747470733a2f2f706f7365722e707567782e6f72672f746b6f746f737a2f626c6f636b2d6465636f7261746f722d6d6167656e746f322f6c6963656e7365)](https://packagist.org/packages/tkotosz/block-decorator-magento2)[![Latest Stable Version](https://camo.githubusercontent.com/0e69140f8efc4271fee1a970c73e218cf90391083392e5f6eedebaa89fc44750/68747470733a2f2f706f7365722e707567782e6f72672f746b6f746f737a2f626c6f636b2d6465636f7261746f722d6d6167656e746f322f76657273696f6e)](https://packagist.org/packages/tkotosz/block-decorator-magento2)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/2b459ba05430721f16050bbb4cf878b57c1dc076c32a5638c122d11f17e52416/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746b6f746f737a2f626c6f636b2d6465636f7261746f722d6d6167656e746f322f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tkotosz/block-decorator-magento2/?branch=master)[![Build Status](https://camo.githubusercontent.com/9139e9c1e5e4625ae7a1d17d364bb8a287920fbbd5ae447605d79b128a6b855e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746b6f746f737a2f626c6f636b2d6465636f7261746f722d6d6167656e746f322f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tkotosz/block-decorator-magento2/build-status/master)

This module allows it to decorate Blocks used in the layout with extra data based on interfaces implemented by the blocks.

Installation
------------

[](#installation)

Install by adding to your `composer.json`:

```
composer require tkotosz/block-decorator-magento2
```

How it works?
-------------

[](#how-it-works)

The module registers an "after plugin" for the `Magento\Framework\View\Element\BlockFactory` which used by Magento to instantiate Blocks. In this plugin the block object created by the factory passed over to all registered decorators to decorate the block with extra data if needed. Each decorator is responsible for checking the type of the block and decide whether it needs to do anything.

How to use?
-----------

[](#how-to-use)

1. Create an interface which can be implemented by any block to get a specific data. (example: `Tkotosz\BlockDecorator\View\Element\Block\CurrentProduct\ProductNameAwareInterface`)
2. Create your block class in the same way as you do it normally and implement your interface created in the 1st step. (example: `Tkotosz\BlockDecorator\Block\Product\View\ProductName`)
3. Create your own decorator which can decorate the blocks with the required data when applicable (when your interface is implemented by the block). To create a the decorator you just need to create a new class which implements the `Tkotosz\BlockDecorator\View\Element\Block\Decorator\DecoratorInterface`. (example: `Tkotosz\BlockDecorator\View\Element\Block\Decorator\CurrentProductName`)
4. Register your decorator in the Magento di like this:

```

            Your\Awesome\Decorator

```

(example: see how `Tkotosz\BlockDecorator\View\Element\Block\Decorator\CurrentProductName` is registered in the `src/etc/di.xml`)

5. Add your new block to any layout, when the block is instantiated your decorator will run to set the required data, which later can be used when the block is rendered.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Every ~190 days

Total

3

Last Release

2581d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6451ac5fdc814bfa3aec1b3cf746fdb3ccec68ccbbe3a6f30b3b6c9266b0cb79?d=identicon)[tkotosz](/maintainers/tkotosz)

### Embed Badge

![Health badge](/badges/tkotosz-block-decorator-magento2/health.svg)

```
[![Health](https://phpackages.com/badges/tkotosz-block-decorator-magento2/health.svg)](https://phpackages.com/packages/tkotosz-block-decorator-magento2)
```

###  Alternatives

[snowdog/module-menu

Provides powerful menu editor to replace category based menus in Magento 2

3271.7M5](/packages/snowdog-module-menu)[baldwin/magento2-module-url-data-integrity-checker

Magento 2 module which can find potential url related problems in your catalog data

281773.3k](/packages/baldwin-magento2-module-url-data-integrity-checker)[sivaschenko/magento2-clean-media

Magento 2 media analysis and cleanup

96231.9k](/packages/sivaschenko-magento2-clean-media)[yireo/magento2-extensionchecker

Scan the code of a Magento module

96151.6k3](/packages/yireo-magento2-extensionchecker)[graycore/magento2-graphql-introspection-cache

1015.2k](/packages/graycore-magento2-graphql-introspection-cache)

PHPackages © 2026

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