2017 © Pedro Peláez
 

library laravel-shortcode

Simple Laravel Shortcode

image

nerweb/laravel-shortcode

Simple Laravel Shortcode

  • Monday, November 10, 2014
  • by reillo
  • Repository
  • 1 Watchers
  • 6 Stars
  • 56 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

laravel-shortcode (abandoned)

use pingpong/shortcode instead., (*1)

Really Simple Laravel Shortcode, (*2)


Installation

Add the following to your composer.json file:, (*3)

"nerweb/laravel-shortcode": "dev-master"

Then, run composer update nerweb/laravel-shortcode or composer install if you have not already installed packages., (*4)

Add the below line to the providers array in app/config/app.php configuration file (add at the end):, (*5)

'Nerweb\Shortcode\ShortcodeServiceProvider',

Add the below line to the aliases array in app/config/app.php configuration file (add at the end):, (*6)

'Shortcode' => 'Nerweb\Shortcode\Facades\Shortcode',

Usage

$string = '
Hi [FIRST_NAME] [LAST_NAME],

To confirm your account.

please click [confirm_url title="Confirm example" text="here"]

or

[CONFIRM_URL_TEXT]

Thanks,
[FROM_NAME]
';

Shortcode::register('FROM_NAME', 'Lisa Dy');

Shortcode::register('confirm_url', function($parameters = array(), $Shortcode) {
    // short code available parameters
    $href           = array_get($parameters, 'href');
    $title          = array_get($parameters, 'title');
    $text           = array_get($parameters, 'text');

    // link
    return link_to($Shortcode->get('CONFIRM_URL_TXT'), $text, array(
        'title' => $title
    ));
});

// Register on decode
echo Shortcode::decode($string, array(
    'FIRST_NAME'        => 'Hamill',
    'LAST_NAME'         => 'Esmeralda',
    'CONFIRM_URL_TEXT'  => URL::to('/account/confirm/?something=here')
));

License

This project is open-sourced software licensed under the MIT license., (*7)

The Versions

10/11 2014

dev-master

9999999-dev

Simple Laravel Shortcode

  Sources   Download

MIT

The Requires

 

laravel shortcode

09/11 2014

v0.2.0

0.2.0.0

Simple Laravel Shortcode

  Sources   Download

MIT

The Requires

 

laravel shortcode