1. Go to this page and download the library: Download inventor96/mako-template-pp 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/ */
return [
/**
* The `time:` template filter.
*/
'time' => [
/**
* The format to use when displaying date/time values.
* Defaults to 'D, j M Y g:i:s a T'.
*/
'format' => 'D, j M Y g:i:s a T',
/**
* The string to display when the date/time value is empty.
* Defaults to '---'.
*/
'empty_replacement' => '---',
],
];
namespace app\services;
use inventor96\MakoTemplatePP\FilterRegistry;
use mako\application\services\Service;
class UppercaseTemplateFilter extends Service
{
/**
* Registers the service.
*/
public function register(): void
{
// get the FilterRegistry from the container
$registry = $this->container->get(FilterRegistry::class);
// register the 'uppercase' filter
$registry->registerFilterCallback('uppercase', function ($string) {
return strtoupper($string);
});
}
}