PHP code example of magehx / mage-template-utils

1. Go to this page and download the library: Download magehx/mage-template-utils 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/ */

    

magehx / mage-template-utils example snippets


<?= $esc->html(__('Hello world!')) 

<?= $escaper->escapeHtml(__('Hello world!')) 


use Namespace\Module\ViewModel\YourViewModel;
use MageHx\MageTemplateUtils\Model\ViewModelProvider;

/** @var ViewModelProvider $viewModelProvider */

$viewModel = $viewModelProvider->get(YourViewModel::class);

<form>
    <?= $formKey 

<script nonce="<?= $esc->htmlAttr($nonce) 

<div class="flex items-center <?= $escaper->escapeHtmlAttr($condition1 ? 'justify-between' : 'justify-center') 

<div class="<?= $classNames([
    'flex items-center',
    $condition1 ? 'justify-between' : 'justify-center',
    'bg-orange' => $i > 10
])