1. Go to this page and download the library: Download italystrap/html 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/ */
italystrap / html example snippets
use ItalyStrap\HTML\AttributesInterface;
$sut = new AttributesInterface();
$sut->add( 'context', [
'class' => 'color-primary',
'id' => 'unique_id',
] );
// ' class="color-primary" id="unique_id"'
echo $sut->render( 'context' );
$sut->add( 'another_context', [
'class' => '', // This will be skipped because empty
'attr1' => null, // This will be skipped because null
'attr2' => false, // This will be skipped because false
'attr3' => 0, // This will be skipped because 0 is also false
'id' => 'unique_id',
] );
// ' id="unique_id"'
echo $sut->render( 'another_context' );
use ItalyStrap\HTML\{Tag,AttributesInterface};
Tag::$is_debug = true; // This will print comment <! some comment> around the output for debugging, you can see it with ctrl + u key in the browser
$sut = new Tag( new AttributesInterface() );
// <div class="someClass">Some content inside HTML div tags</div>
echo $sut->open( 'some_context', 'div', [ 'class' => 'someClass' ] );
echo 'Some content inside HTML div tags';
echo $sut->close( 'some_context' );
// <input type="text"/>
echo $sut->void( 'some_other_context', 'input', [ 'type' => 'text' ] );
use ItalyStrap\HTML\{Tag,AttributesInterface};
$context = 'some_context';
\add_filter("italystrap_{$context}_tag", function( string $tag, string $context, Tag $obj) {
// Do some staff with $tag
$new_tag = 'span';
return $new_tag;
}, 10, 3);
$sut = new Tag( new AttributesInterface() );
echo $sut->open( 'some_context', 'div', [ 'class' => 'someClass' ] );
echo 'Some content inside HTML div tags';
echo $sut->close( 'some_context' );
// <span class="someClass">Some content inside HTML div tags</span>
html
<span get_attr_e( $context, $attr, true )
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.