1. Go to this page and download the library: Download ui-awesome/html-concern 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/ */
declare(strict_types=1);
namespace App\Component;
use UIAwesome\Html\Mixin\HasContent;
final class MyComponent
{
use HasContent;
}
enum ContentMessage: string
{
case GUIDANCE = 'Capture <events> & inspect them.';
}
$component = new MyComponent();
$enumContent = $component->content(ContentMessage::GUIDANCE)->getContent();
// Capture <events> & inspect them.
$encodedContent = $component
->content('<script>alert("XSS")</script>')
->getContent();
// <script>alert("XSS")</script>
$component2 = new MyComponent();
$htmlContent = $component2
->html('<strong>Raw HTML</strong>')
->getContent();
// <strong>Raw HTML</strong>
enum TrustedMarkup: string
{
case NOTICE = '<strong>Saved & ready</strong>';
}
$rawEnumContent = $component2->html(TrustedMarkup::NOTICE)->getContent();
// <strong>Saved & ready</strong>
declare(strict_types=1);
namespace App\Component;
use UIAwesome\Html\Mixin\{HasContent, HasTemplate};
final class MyComponent
{
use HasContent;
use HasTemplate;
public function render(): string
{
return str_replace('{content}', $this->content, $this->template);
}
}
$component = new MyComponent();
echo $component
->content('Card Content')
->template('<div class="card">{content}</div>')
->render();
// <div class="card">Card Content</div>
declare(strict_types=1);
namespace App\Component;
use UIAwesome\Html\Mixin\{HasContent, HasPrefixCollection, HasSuffixCollection};
enum InlineTag: string
{
case STRONG = 'strong';
case EM = 'em';
}
final class MyComponent
{
use HasContent;
use HasPrefixCollection;
use HasSuffixCollection;
public function render(): string
{
return $this->prefix . $this->content . $this->suffix;
}
}
$component = new MyComponent();
echo $component
->content('Main Content')
->prefix('Prefix: ')
->prefixAttributes(['class' => 'prefix-badge'])
->prefixTag(InlineTag::STRONG)
->suffix(' :Suffix')
->suffixTag(InlineTag::EM)
->render();
// Prefix: Main Content :Suffix
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.