PHP code example of arc / html

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

    

arc / html example snippets


	use \arc\html as h;
	$htmlString = h::doctype()
	 .h::html(
	 	h::head(
	 		h::title('Example site')
	 	),
	 	h::body(
	 		['class' => 'homepage'],
	 		h::h1('An example site')
	 	)
	 );

	$html = \arc\html::parse($htmlString);
	$title = $html->head->title->nodeValue; // SimpleXMLElement 'Example site'
	$titleTag = $html->head->title; // <title>Example site</title>

	$title = current($html->find('title'));

	$class = $html->html->body['class'];
	$class = $html->html->body->attributes('version');

	$title = $html->html->head->title;

	$class = $html->html->body->getAttributes('class');
	$title = current($html->getElementsByTagName('title'));

    $htmlString = <<< EOF
<li>
	<a href="anitem/">An item</a>
</li>
<li>
	<a href="anotheritem/">Another item</a>
</li>
EOF;
	$html = \arc\html::parse($htmlString);
	$links = $html->find('a');

    $htmlString = <<< EOF
<ul>
	<li>
		<a href="anitem/">An item</a>
	</li>
	<li>
		<a href="anotheritem/">Another item</a>
	</li>
</ul>
EOF;
	$html = \arc\html::parse($htmlString);
	$ul = $html->ul;