PHPackages                             thelia/short-code-module - 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. thelia/short-code-module

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

thelia/short-code-module
========================

2.0.0(3y ago)017.2k↑125%23LGPL-3.0+PHP

Since Jan 17Pushed 8mo ago5 watchersCompare

[ Source](https://github.com/thelia-modules/ShortCode)[ Packagist](https://packagist.org/packages/thelia/short-code-module)[ RSS](/packages/thelia-short-code-module/feed)WikiDiscussions main Synced 1mo ago

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

ShortCode
=========

[](#shortcode)

Implementation of Wordpress' Shortcode syntax in Thelia (with ).
This module scan the Thelia response at the research of registred short code (in DB), if a short code is find the module dispatch the associated event.

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

[](#installation)

### Manually

[](#manually)

- Copy the module into `/local/modules/` directory and be sure that the name of the module is ShortCode.
- Activate it in your thelia administration panel

### Composer

[](#composer)

Add it in your main thelia composer.json file

```
composer require thelia/shortcode-module:~1.0

```

Usage
-----

[](#usage)

This module  is a good example of how to use ShortCode.

### 1. Register your short codes

[](#1-register-your-short-codes)

You can do this at the post activation of your module. The best way to do this is to use the module method : `ShortCode::createNewShortCodeIfNotExist`the first parameter is the name you will use to call the short code in your templates (like this `\[my\_shortcode\_name\], second parameter is the event dispatched when the short code is detected.

### 2. Add short codes to your templates

[](#2-add-short-codes-to-your-templates)

The short codes syntax is as follows:

```
[shortcode] - No content, no attributes
[shortcode]My Content[/shortcode] - Short code with content
[shortcode attribute=value foo=bar] - Short code with attributes
[shortcode attribute=value foo=bar]My Content[/shortcode] - Short code with content and attributes

```

### 3. Listen events associated to your short codes

[](#3-listen-events-associated-to-your-short-codes)

When a short code is detected in response a `ShortCodeEvent` is dispatched with the event name given at the creation. So if you want replace your short code by something you have to listen this event. In this event you have 3 properties :

- `content` (string) The content between your tags it will be `My Content` for the example above.
- `attributes` (array) The array of all attributes passed to your short code `['attribute'=>'value', 'foo'=>'bar']` for the example above.
- `result` (string) Your short code will be replaced by this value in response (equal to content by default)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance43

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 77.8% 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

Every ~638 days

Total

4

Last Release

763d ago

Major Versions

1.0.1 → 2.0.02022-08-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2196919?v=4)[thelia](/maintainers/thelia)[@thelia](https://github.com/thelia)

---

Top Contributors

[![lopes-vincent](https://avatars.githubusercontent.com/u/6057206?v=4)](https://github.com/lopes-vincent "lopes-vincent (7 commits)")[![anoziere](https://avatars.githubusercontent.com/u/118798868?v=4)](https://github.com/anoziere "anoziere (1 commits)")[![gillesbourgeat](https://avatars.githubusercontent.com/u/7335734?v=4)](https://github.com/gillesbourgeat "gillesbourgeat (1 commits)")

---

Tags

shortcodethelia

### Embed Badge

![Health badge](/badges/thelia-short-code-module/health.svg)

```
[![Health](https://phpackages.com/badges/thelia-short-code-module/health.svg)](https://phpackages.com/packages/thelia-short-code-module)
```

PHPackages © 2026

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