PHPackages                             matteohertel/mh-widget - 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. matteohertel/mh-widget

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

matteohertel/mh-widget
======================

Flexible widget system with built in parser

0.1.0(11y ago)2165MITPHP

Since Feb 17Pushed 10y ago1 watchersCompare

[ Source](https://github.com/matteo-hertel/MH_Widget)[ Packagist](https://packagist.org/packages/matteohertel/mh-widget)[ RSS](/packages/matteohertel-mh-widget/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

MH\_Widget
==========

[](#mh_widget)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/cd72d386f49375b3ac4a6e8e9060c472449b647b2c17a588caad805ab128c0bc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d617474656f2d68657274656c2f4d485f5769646765742f6261646765732f7175616c6974792d73636f72652e706e673f623d446576656c6f706d656e74)](https://scrutinizer-ci.com/g/matteo-hertel/MH_Widget/?branch=Development)[![Build Status](https://camo.githubusercontent.com/966f35feac25bb1a0356742ce6b15168bb4a756ba124bc0267ec41416d10c9b7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d617474656f2d68657274656c2f4d485f5769646765742f6261646765732f6275696c642e706e673f623d446576656c6f706d656e74)](https://scrutinizer-ci.com/g/matteo-hertel/MH_Widget/build-status/Development)

Demo: [http://test.matteohertel.uk/mh\_widget/](http://test.matteohertel.uk/mh_widget/)

Flexible, highly configurable widget system replace an HTML place holder with any content.

The main purpose for this package was to be used alongside a text editor like CKEditor to implement a flexible widget system for the end user([http://docs.ckeditor.com/#!/guide/widget\_sdk\_tutorial\_1](http://docs.ckeditor.com/#!/guide/widget_sdk_tutorial_1))

This package will provide a nice and neat interface to create widgets ready to use in any project, there are a lots of feature straight out of the box, but with its flexible nature can fit any need.

There are two main ways to use this package:

- Use the widget system standalone as easy way to render HTML
- Use the widget system with the integrated parser

To use the widget standalone:

1. Create an instance of \\MHDev\\WidgetCore\\MH\_Widget
2. Call the instance as a function (to trigger the magic `__invkoke`) passing two arguments (one optional): namespace, config array
3. under the hood the class will:
    - create a new instance of the requested widget in the given namespace(or use the default one \\MHDev\\Widgets\\ and pass the config object
    - call the instance as function (to trigger the magic `__invkoke`) and return the result

### The single widget workflow is:

[](#the-single-widget-workflow-is)

1. from the magic invoke the the `controller` method is called
2. the `controller` method call the `model` method to get data
3. the `controlle`r will call and return the view method passing the data from the model
    - if the `prevent_view` kay is found in the config array the controller will return the data from the model without call the view

\###Using the parser With the integrated parser you can use a custom non-standard html tag mhwidget with attributes to render content from the widget, and example of a working tag:

```
Gravatar

```

\##Under the hood

To be a proper widget the class must extend the WidgetAbstract class and override the `__invoke`, `controller`, `model` and `view` methods,

\##Usage

Simple hello world

```
$widget = new \MHDev\WidgetCore\MH_Widget("\MHDev\Widgets\\");
echo $widget("Example\HelloWorld");

```

Gravatar

```
$widget = new \MHDev\WidgetCore\MH_Widget("\MHDev\Widgets\\");
echo $widget("Gravatar", ["email" => "info@matteohertel.com", "size" => 80]);

```

\##Example To see the package in action run the following(php must be available in the console):

```
git clone https://github.com/matteo-hertel/MH_Widget.git
cd MH_Widget
php -S localhost:8080 -t ./Example

```

the open your browser to

Version
-------

[](#version)

0.2

Feedback
--------

[](#feedback)

Please, send me your feedback, using the issue tracker on github or via email to info\[at\]matteohertel.com

Dependencies
------------

[](#dependencies)

There are no external dependencies but the Parser require the native DOMDocument class and a the widget tag syntax must be right to work properly

License
-------

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

4102d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6706a876a56d406478a0cd42d608c875514c5dbd9db040533fbeb09e9630781a?d=identicon)[matteo-hertel](/maintainers/matteo-hertel)

---

Top Contributors

[![matteo-hertel](https://avatars.githubusercontent.com/u/3579758?v=4)](https://github.com/matteo-hertel "matteo-hertel (38 commits)")

### Embed Badge

![Health badge](/badges/matteohertel-mh-widget/health.svg)

```
[![Health](https://phpackages.com/badges/matteohertel-mh-widget/health.svg)](https://phpackages.com/packages/matteohertel-mh-widget)
```

###  Alternatives

[thanks-to-it/wp-dich

121.1k](/packages/thanks-to-it-wp-dich)

PHPackages © 2026

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