1. Go to this page and download the library: Download lee-to/yii-blade 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/ */
namespace App\Blade\Directives;
use Closure;
use Leeto\YiiBlade\DirectiveInterface;
use Leeto\YiiBlade\DirectiveType;
final class DateTimeDirective implements DirectiveInterface
{
public function getType(): DirectiveType
{
return DirectiveType::DEFAULT;
}
public function getName(): string
{
return 'datetime';
}
public function handler(): Closure
{
return fn(?string $expression): string => " echo date('Y-m-d H:i:s', $expression);