PHP code example of emreuyguc / easytag
1. Go to this page and download the library: Download emreuyguc/easytag 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/ */
emreuyguc / easytag example snippets
$tag = new Tag(string $name);
Tag::@tagname(array|string|Tag $element) : Tag
$tag->setElements(array<Tag|String> $elements);
$tag->appendElement(Tag|String $elements);
$tag->prependElement(Tag|String $elements);
$tag->setAttrs(array<[key,value]> $attrs);
$tag->addAttr(string $attr, string $value);
$tag->removeAttr(string $attr);
$tag->setSelfClosing(bool $isPaired = TRUE);
$tag->build(): string
$tag->render(): void
TagBuild::@tagname(array|string|Tag $element) : string
HtmlTag::@tagname(array|string|Tag $element) : string
HtmlTag::@tagname(array $attrs, array|string|Tag $element) : string
$data = [
[
'price' => '15.95',
'name' => 'Cap',
'code' => 'C1234'
],
[
'price' => '23.95',
'name' => 'Tshirt',
'code' => 'T1534',
]
];
$products = new Tag('products');
$products->addAttr('last-date','17.08.2021');
foreach ($data as $product_detail){
$product = new Tag('product');
foreach ($product_detail as $key => $value){
$product->appendElement((new Tag($key))->appendElement($value));
}
$products->appendElement($product);
}
$products->render();
PHP
echo TagBuild::config(
TagBuild::server('localhost'),
TagBuild::port('8080'),
TagBuild::db('tagV1'),
TagBuild::user('root'),
TagBuild::pass('toor'),
);