PHPackages                             jhekasoft/html-shortcode - 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. jhekasoft/html-shortcode

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

jhekasoft/html-shortcode
========================

ZF2 module that allows render view helpers using HTML-code.

117PHP

Since Jun 16Pushed 12y ago1 watchersCompare

[ Source](https://github.com/jhekasoft/HtmlShortcode)[ Packagist](https://packagist.org/packages/jhekasoft/html-shortcode)[ RSS](/packages/jhekasoft-html-shortcode/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

HtmlShortcode
=============

[](#htmlshortcode)

Module for Zend Framework 2 that allows render view helpers using HTML-code. You can use this module with editors like TinyMCE and CKEditor.

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

[](#installation)

```
php composer.phar require jhekasoft/html-shortcode:dev-master
```

In `application.config.php` add the following key to your `modules`:

```
'modules' => array(
    //...
    'HtmlShortcode',
),
```

Usage
-----

[](#usage)

At controller:

```
//...
use HMShortCode\Filter\ShortCodeFilter;

class IndexController
{
    public function showAction()
    {
        //...

        $shortCodeFilter = new ShortCodeFilter();
        $shortCodeFilter->setServiceLocator($this->getServiceLocator());

        $item->text = $shortCodeFilter->filter($item->text);

        return array(
            'item' => $item,
        );
    }
}
```

At entity:

```
//...
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use HtmlShortcode\Filter\ShortcodeFilter;

class Pages implements InputFilterAwareInterface, ServiceLocatorAwareInterface
{
    public function exchangeArray($data)
    {
        $this->text = (isset($data['text'])) ? $data['text'] : null;

        // ShortCode filter
        $shortcodeFilter = new ShortcodeFilter();
        $shortcodeFilter->setServiceLocator($this->getServiceLocator());
        $this->filtered_text = $shortcodeFilter->filter($this->text);
    }

    public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
    {
        $this->serviceLocator = $serviceLocator;
        return $this;
    }

    public function getServiceLocator()
    {
        return $this->serviceLocator;
    }
}
```

On bootstrap (except edit action):

```
//...
public function onBootstrap($e)
{
    $app = $e->getApplication();
    $em = $app->getEventManager();

    $em->attach(\Zend\Mvc\MvcEvent::EVENT_ROUTE, function($e) {
        $match = $e->getRouteMatch();
        $action = $match->getParam('action');

        if ('edit' != $action) {
            $sm = $e->getApplication()->getServiceManager();
            $view = $sm->get('ViewRenderer');
            $filters = $view->getFilterChain();
            $widgetFilter = new ShortCodeFilter();
            $widgetFilter->setServiceLocator($sm);
            $filters->attach($widgetFilter, 50);
            $view->setFilterChain($filters);
        }
    });
}
```

HTML-code
---------

[](#html-code)

Samples:

```

```

Second parameter in last example is in JSON format.

The examples above are equivalent this php-code in view-script:

```
echo $this->soundBlock('value1');

echo $this->soundBlock('value2');

echo $this->soundBlock('value3', array("size" => "small"));
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/18330a86b2ab649812c6d3fb6b058242373aa00339be2a883ed364caeb4411f0?d=identicon)[jhekasoft](/maintainers/jhekasoft)

---

Top Contributors

[![jhekasoft](https://avatars.githubusercontent.com/u/1534306?v=4)](https://github.com/jhekasoft "jhekasoft (8 commits)")

### Embed Badge

![Health badge](/badges/jhekasoft-html-shortcode/health.svg)

```
[![Health](https://phpackages.com/badges/jhekasoft-html-shortcode/health.svg)](https://phpackages.com/packages/jhekasoft-html-shortcode)
```

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

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