定制 nerweb/laravel-shortcode 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nerweb/laravel-shortcode

最新稳定版本:v0.2.0

Composer 安装命令:

composer require nerweb/laravel-shortcode

包简介

Simple Laravel Shortcode

README 文档

README

use pingpong/shortcode instead.

Really Simple Laravel Shortcode

Installation

Add the following to your composer.json file:

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

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

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

'Nerweb\Shortcode\ShortcodeServiceProvider',

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

'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.

统计信息

  • 总下载量: 69
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-09