Baigudin Software avatar
Baigudin Software logo
home
ru region
en region

PHP DOM Builder API

PHP DOM Builder has been unveiled in second revision

In 2014 year PHP DOM Builder library was unveiled at the first time within the framework of Baigudin Software project. Two years have been left after that moment and today we are glad to offer the second generation that is PHP DOM Builder Revision 2.

Сonfiguration and settings

Element is the root and primary class of the library class hierarchy. It has methods for setting the library. So, before using the library, the best way is to define next settings:

<?php
use DomBuilder\Element as Element;
// Document type
Element::docType(Element::DOC_XHTML_10); 
// Document compress flag
Element::docCompress(false); 
// Document language 
Element::docLanguage('en'); 
// Print error flag
Element::printError(true);
?> 

Document typesetting

The library supports three types of document: XHTML 1.0, HTML 4.01, and HTML 5. By default the, XHTML 1.0 document type is set. We recommend  you to execute these settings for correct generating of HTML markup when future updating is occurred.

Document compress flag setting

HTML markup can be generated in compressed or decompressed mode. It depends on specified document compress flag. For release project, we advise to set it in true. It gives you a possibility to decrease sent document size by server and discharges it. Debug project should generate a markup in decompressed mode, because you can evaluate a result of what your program has made. By default, this flag is set to compressed mode.

Document language Setting

The library supports a multi-language mode. Given setting sets the primary language for the HTML document and is used for generating error strings. By default, English language is set. You can look for a valid value for the method in official documentation on HTML markup.

Print error flag Setting

Error string messages will be outputted in error conditions if this flag is set. By default, the flag is set.

To the previous article

To the articles list

To the next article