PHP code example of rocketage / behat-shortcode-extension

1. Go to this page and download the library: Download rocketage/behat-shortcode-extension 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/ */

    

rocketage / behat-shortcode-extension example snippets




namespace MyProject;

use Maiorano\Shortcodes\Library\SimpleShortcode;

class CustomShortcode1
{
    public function __invoke()
    {
        return new SimpleShortcode(
            'hostname',
            null,
            /* $content is the string between shortcodes, $atts are parameters */
            function($content = null, array $atts = []) {
                return gethostname();
            }
        );
    }
}