1. Go to this page and download the library: Download seiler/shortcoder library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
seiler / shortcoder example snippets
use Seiler\Shortcoder\Shortcoder;
$shortcoder = new Shortcoder();
$pattern = '[alert * *]';
$replacement = '<div class="alert alert-*">*</div>';
$shortcoder->add($pattern, $replacement);
echo $shortcoder->parse('[alert danger This is important!]');
// <div class="alert alert-danger">This is important!</div>
$pattern = '/(?<=^|\s)@(\w{1,15})/m'; // Twitter @handle
$replacement = '<a href="https://twitter.com/$1">@$1</a>';
// setting the third argument
$shortcoder->set($pattern, $replacement, true);
// or setting the 'regex' attribute
$shortcoder->set([
'pattern' => $pattern,
'replacement' => $replacement,
'regex' => true
]);
echo $shortcoder->parse('Do you follow @php_net ?');
// Do you follow <a href="https://twitter.com/php_net">@php_net</a> ?
$pattern = '* then *';
$replacement = '$2 then *';
$shortcoder->add($pattern, $replacement);
echo $shortcoder->parse('first then second');
// second then first
$shortcoder->add('[info *]', '<div class="info" markdown=1>*</div>');
$text = $shortcoder->parse('[info You can use *markdown* in HTML elements.]');
echo $parsedownExtra->text($text);
// <div class="info">
// <p>You can use <em>markdown</em> in HTML elements.</p>
// </div>
$shortcoder->add('[info *]', '<span class="info">*</span>');
$text = $shortcoder->parse('[info You can use *markdown* in inline HTML elements.]');
echo $commonMark->convertToHtml($text);
// <p><span class="info">You can use <em>markdown</em> in inline HTML elements.</span></p>
$shortcoder->add('[info *]', '<div class="info">*</div>');
$text = $shortcoder->parse('[info
You can use *markdown* in block HTML elements.
]');
echo $commonMark->convertToHtml($text);
// <div class="info">
// <p>You can use <em>markdown</em> in block HTML elements.</p>
// </div>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.