PHP code example of wert1209yt / htmlman

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

    

wert1209yt / htmlman example snippets



Man::init(); // Init will add all base HTML5 elements classes

HtmlMan::register([
    'name' => 'Card',
    'tag' => 'div', // Or any html tag (WebComponents support)
    'class' => 'card',
    'id' => '123',
    'style' => [
        'background-color' => '#ffffff',
        'border' => '1px solid #ddd'
    ], // Or string 'background-color: #ffffff; border: 1px solid #ddd'

    // Element structure
    'structure' => new Main([
        (new Div([
            new P() // Will put content there
        ]))->class('card-body')
    ])
]);

HtmlMan::register([
    'name' => 'YourElement',
    'tag' => 'div'
])

$div = new Div([ new P('Example)])

echo $div->format();

$div = (new Div([ new P('Example)]))
       ->class('example')
       ->id('123')
       ->style('display: none');

$html = (new Div([ new P('Example)]))
         ->format();

echo (new A('link'))
    ->href('https://github.com')
    ->target('_blank')
    ->class('link-style');