PHPackages                             flexpress/component-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. flexpress/component-shortcode

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

flexpress/component-shortcode
=============================

Shortcode helper for WordPress

v1.0.0(11y ago)0901PHP

Since Aug 13Pushed 11y ago1 watchersCompare

[ Source](https://github.com/FlexPress/component-shortcode)[ Packagist](https://packagist.org/packages/flexpress/component-shortcode)[ RSS](/packages/flexpress-component-shortcode/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (2)Used By (1)

FlexPress shortcode component
=============================

[](#flexpress-shortcode-component)

Install with Pimple
-------------------

[](#install-with-pimple)

The Shortcode component uses two classes:

- AbstractShortcode, which you extend to create a Shortcode.
- ShortcodeHelper, which hooks into everything for you and registers the shortcodes.

Lets create a pimple config for both of these

```
$pimple["documentLinkShortcode"] = function () {
  return new DocumentLink();
};

$pimple['ShortcodeHelper'] = function ($c) {
    return new ShortcodeHelper($c['objectStorage'], array(
        $c["documentLinkShortcode"]
    ));
};

```

- Note the dependency $c\['objectStorage'\] is a SPLObjectStorage

Creating a concreate shortcode class
------------------------------------

[](#creating-a-concreate-shortcode-class)

Create a concreate class that implements the AbstractShortcode class and implements the getName() and getCallback() methods.

```
class DocumentLink extends AbstractShortcode {

    public function getName()
    {
      return "document_link";
    }

    public function getCallback()
    {
      $link = func_get_arg(0);
      return 'Download document';
    }

}

```

### Public Methods

[](#public-methods)

- getName() - returns the name of the shortcode that will be used in the editor.
- getCallback() - returns the markup of the shortcode.

ShortcodeHelper usage
---------------------

[](#shortcodehelper-usage)

Once you have setup the pimple config you are use the ShortcodeHelper like this

```
$helper = $pimple['ShortcodeHelper'];
$helper->registerShortcodes();

```

That's it, the helper will then add all the needed hooks and register all the shortcodes you have provided it.

### Public methods

[](#public-methods-1)

- registerShortcodes() - Registers the shortcodes provided.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

4296d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b794650fae4ab8d86e8550fa2e0cd8658323e07a8d78b3e96d0bc373bc88d2a?d=identicon)[timperry](/maintainers/timperry)

### Embed Badge

![Health badge](/badges/flexpress-component-shortcode/health.svg)

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

###  Alternatives

[nojimage/cakephp-environment

CakePHP Environment Plugn. The configuration switching library by filebase.

11242.5k](/packages/nojimage-cakephp-environment)

PHPackages © 2026

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