PHPackages                             tpoxa/shortcodes - 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. tpoxa/shortcodes

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

tpoxa/shortcodes
================

Wordpress style shorttags support for Yii2

2313.5k↓50%12PHP

Since Oct 20Pushed 8y ago6 watchersCompare

[ Source](https://github.com/tpoxa/yii2-shortcodes)[ Packagist](https://packagist.org/packages/tpoxa/shortcodes)[ RSS](/packages/tpoxa-shortcodes/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-shortcodes
===============

[](#yii2-shortcodes)

Wordpress style shortcodes support for Yii2

Most part of the code taken from

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

[](#installation)

```
{
	"require": {
  		"tpoxa/shortcodes": "dev-master"
	}
}

```

Configuration
-------------

[](#configuration)

In config file

```
/config/main.php

```

Add shortcodes component

```
'components' => array(
        ...
        'shortcodes' => [
            'class' => 'tpoxa\shortcodes\Shortcode',
            'callbacks' => [
                'lastphotos' => ['frontend\widgets\lastPhoto\lastPhoto', 'widget'],
                'anothershortcode'=>function($attrs, $content, $tag){
                ///
                },

            ]
        ],

```

Usage
-----

[](#usage)

```
echo \Yii::$app->shortcodes->parse('
            some content  [lastphotos limit=8]  >
    ')
```

Additional
----------

[](#additional)

callbacks - An array of valid PHP callbacks. Keys should contain names of the shortcodes.

lastPhoto example class - common Yii2 widget

```
namespace frontend\widgets\lastPhoto; // your App class

use yii\base\Widget;
class lastPhoto extends Widget {

    public $limit = 5; // this parameter will be overwritten by 8

    public function run() {
        // your widget content goes here
    }

}
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community13

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/1a0676925a7c4e0aa0d67f96c4eb2ea4757e051eb0628ae8ab1426009ccbc4bd?d=identicon)[mtrofimenko](/maintainers/mtrofimenko)

---

Top Contributors

[![tpoxa](https://avatars.githubusercontent.com/u/431546?v=4)](https://github.com/tpoxa "tpoxa (12 commits)")

### Embed Badge

![Health badge](/badges/tpoxa-shortcodes/health.svg)

```
[![Health](https://phpackages.com/badges/tpoxa-shortcodes/health.svg)](https://phpackages.com/packages/tpoxa-shortcodes)
```

###  Alternatives

[streamcommon/promise

PHP-CLI promise implementation

152.0k](/packages/streamcommon-promise)

PHPackages © 2026

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