PHP code example of vierbergenlars / appendr

1. Go to this page and download the library: Download vierbergenlars/appendr 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/ */

    

vierbergenlars / appendr example snippets




// ...
$twig = new Twig_Environment($loader);
$twig->addFunction(new \Twig_SimpleFunction('headTitle', new \vierbergenlars\Appendr));
// headTitle is just an example name, you can name it anything you want.



use vierbergenlars\Appendr;

// ...

$twig = new Twig_Environment($loader);

// Set default options in the constructor. (null skips an option)
$appendr = new Appendr('~', '_/°° %s °°\_', Appendr::APPEND);

// And register the Twig function
$twig->addFunction(new \Twig_SimpleFunction('fancyTitle', $appendr));

// Or set them on the instance later
$appendr->setSeparator('~');
$appendr->setPattern('_/°° %s °°\_');
$appendr->setDefaultAttachOrder(Appendr::APPEND);