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

ActiveLibrary

brouwers/shortcodes
===================

Wordpress like shortcodes for Laravel 4.2

1.0.2(11y ago)2012.7k3[1 issues](https://github.com/patrickbrouwers/Laravel-Shortcodes/issues)1BSD-3-ClausePHPPHP &gt;=5.4.0

Since Jul 12Pushed 9y ago1 watchersCompare

[ Source](https://github.com/patrickbrouwers/Laravel-Shortcodes)[ Packagist](https://packagist.org/packages/brouwers/shortcodes)[ RSS](/packages/brouwers-shortcodes/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (3)Versions (5)Used By (1)

Laravel-Shortcodes
==================

[](#laravel-shortcodes)

Wordpress like shortcodes for Laravel 4.2.

```
[b class="bold"]Bold text[/b]

[tabs]
  [tab]Tab 1[/tab]
  [tab]Tab 2[/tab]
[/tabs]

[user id="1" display="name"]
```

> If you are looking for BBcodes, see:

[![Build Status](https://camo.githubusercontent.com/cc143bc4e946a8c8149110091579f633d553f8404a7005231c863513e815a77d/68747470733a2f2f7472617669732d63692e6f72672f7061747269636b62726f75776572732f4c61726176656c2d53686f7274636f6465732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/patrickbrouwers/Laravel-Shortcodes)[![Latest Stable Version](https://camo.githubusercontent.com/ac25d1869f550b2b5d7be4355583cee80ffadd61f2bb0453569fd3f046dbdff3/68747470733a2f2f706f7365722e707567782e6f72672f62726f75776572732f73686f7274636f6465732f762f737461626c652e706e67)](https://packagist.org/packages/brouwers/shortcodes) [![Total Downloads](https://camo.githubusercontent.com/7ac76a21fad430600baf5e6d67aaf9c2bcb5bb1af4f696c049b58a2063e625e6/68747470733a2f2f706f7365722e707567782e6f72672f62726f75776572732f73686f7274636f6465732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/brouwers/shortcodes) [![License](https://camo.githubusercontent.com/16ddf7149cf9cb0b6b77df8c3781b1006c349cc714a2a461c55f6040b62db1d0/68747470733a2f2f706f7365722e707567782e6f72672f62726f75776572732f73686f7274636f6465732f6c6963656e73652e706e67)](https://packagist.org/packages/brouwers/shortcodes)[![Monthly Downloads](https://camo.githubusercontent.com/b336d1c1cfca375e550757d5e072b2afe39a20ec590fb537f78f5434f6a58571/68747470733a2f2f706f7365722e707567782e6f72672f62726f75776572732f73686f7274636f6465732f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/brouwers/shortcodes)[![Daily Downloads](https://camo.githubusercontent.com/0e204c1ace52d52e052a3aac1c2c50acb3032d77eb1ee91d4e0d2c7e9f91aa0e/68747470733a2f2f706f7365722e707567782e6f72672f62726f75776572732f73686f7274636f6465732f642f6461696c792e706e67)](https://packagist.org/packages/brouwers/shortcodes)

\#Installation

Require this package in your `composer.json` and update composer.

```
"brouwers/shortcodes": "1.*"
```

After updating composer, add the ServiceProvider to the providers array in `app/config/app.php`

```
'Brouwers\Shortcodes\ShortcodesServiceProvider',
```

You can use the facade for shorter code. Add this to your aliases:

```
'Shortcode' => 'Brouwers\Shortcodes\Facades\Shortcode',
```

The class is bound to the ioC as `shortcode`

```
$shortcode = App::make('shortcode');
```

Usage
=====

[](#usage)

View compiling
--------------

[](#view-compiling)

By default shortcode compiling is set to false inside the config.

### withShortcodes()

[](#withshortcodes)

To enable the view compiling features:

```
return View::make('view')->withShortcodes();
```

This will enable shortcode rendering for that view only.

### Config

[](#config)

Enabeling the shortcodes through config `shortcodes::enabled` will enable shortcoding rendering for all views.

### Enable through class

[](#enable-through-class)

```
Shortcode::enable();
```

### Disable through class

[](#disable-through-class)

```
Shortcode::disable();
```

### Disabeling some views from shortcode compiling

[](#disabeling-some-views-from-shortcode-compiling)

With the config set to true, you can disable the compiling per view.

```
return View::make('view')->withoutShortcodes();
```

Default compiling
-----------------

[](#default-compiling)

To use default compiling:

```
Shortcode::compile($contents);
```

Registering new shortcodes
--------------------------

[](#registering-new-shortcodes)

Inside a file or service provider you can register the shortcodes. (E.g. `app/start/shortcodes.php` or `App/Services/ShortcodeServiceProvider.php`)

### Callback

[](#callback)

Shortcodes can be registered like Laravel macro's with a callback:

```
Shortcode::register('b', function($shortcode, $content, $compiler, $name)
{
  return '' . $content . '';
});

```

### Default class

[](#default-class)

```
class BoldShortcode {

  public function register($shortcode, $content, $compiler, $name)
  {
    return '' . $content . '';
  }
}

Shortcode::register('b', 'BoldShortcode');
```

### Class with custom method

[](#class-with-custom-method)

```
class BoldShortcode {

  public function custom($shortcode, $content, $compiler, $name)
  {
    return '' . $content . '';
  }
}

Shortcode::register('b', 'BoldShortcode@custom');
```

### Register helpers

[](#register-helpers)

If you only want to show the html attribute when the attribute is provided in the shortcode, you can use `$shortcode->get($attributeKey, $fallbackValue = null)`

```
class BoldShortcode {

  public function register($shortcode, $content, $compiler, $name)
  {
    return '' . $content . '';
  }
}
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 95.7% 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 ~49 days

Total

4

Last Release

4181d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aba65a2b4ccb2b2d971b8da88a4916c4d9d4d4fc4dc3944a7d6931947863b52e?d=identicon)[patrickbrouwers](/maintainers/patrickbrouwers)

---

Top Contributors

[![patrickbrouwers](https://avatars.githubusercontent.com/u/7728097?v=4)](https://github.com/patrickbrouwers "patrickbrouwers (22 commits)")[![jvdanilo](https://avatars.githubusercontent.com/u/6813993?v=4)](https://github.com/jvdanilo "jvdanilo (1 commits)")

---

Tags

laravelwordpressshortcodes

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[webwizo/laravel-shortcodes

Wordpress like shortcodes for Laravel 5, 6, 7, 8, 9, 10, 11 and 12

216658.5k6](/packages/webwizo-laravel-shortcodes)[tehwave/laravel-shortcodes

Simple, elegant WordPress-like Shortcodes the Laravel way

1274.3k](/packages/tehwave-laravel-shortcodes)[vedmant/laravel-shortcodes

Wordress like shortcodes for Laravel

2811.2k2](/packages/vedmant-laravel-shortcodes)

PHPackages © 2026

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