Skip to content

hexlet-components/php-html-tags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-html-tags

github action status

Functions for working with HTML tags.

Examples

<?php

use function Php\Html\Tags\HtmlTags\make;
use function Php\Html\Tags\HtmlTags\append;
use function Php\Html\Tags\HtmlTags\node;
use function Php\Html\Tags\HtmlTags\toString;
use function Php\Html\Tags\HtmlTags\addChild;
use function Php\Html\Tags\HtmlTags\hasChildren;
use function Php\Html\Tags\HtmlTags\getName;
use function Php\Html\Tags\HtmlTags\getValue;

$p = node('p', 'paragraph');
$ul = node('ul');
$ul2 = addChild($ul, node('li', 'body'));
$ul3 = addChild($ul2, node('li', 'another body'));
$dom1 = make();
$dom2 = append($dom1, $p);
$dom3 = append($dom2, $ul3);

toString($dom3);
// '<p>paragraph</p><ul><li>body</li><li>another body</li></ul>';

getName($p); // 'p'
getValue($p); // 'paragraph'
hasChildren($p); // false

Hexlet Ltd. logo

This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet.

See most active contributors on hexlet-friends.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •