PHPackages                             webignition/html-document-type - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. webignition/html-document-type

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

webignition/html-document-type
==============================

For parsing, validating and creating HTML doctype strings

0.1.1(8y ago)01.3kMITPHPPHP &gt;=5.6

Since Mar 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/webignition/html-document-type)[ Packagist](https://packagist.org/packages/webignition/html-document-type)[ Docs](https://github.com/webignition/html-document-type)[ RSS](/packages/webignition-html-document-type/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

For parsing, validating and creating HTML doctype strings (in PHP)
==================================================================

[](#for-parsing-validating-and-creating-html-doctype-strings-in-php)

[![Master build status](https://camo.githubusercontent.com/621e4ace9d68505e64798556b464e06df9a3f7cd2602c951a754d6d416e15598/68747470733a2f2f7472617669732d63692e6f72672f77656269676e6974696f6e2f68746d6c2d646f63756d656e742d747970652e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/621e4ace9d68505e64798556b464e06df9a3f7cd2602c951a754d6d416e15598/68747470733a2f2f7472617669732d63692e6f72672f77656269676e6974696f6e2f68746d6c2d646f63756d656e742d747970652e7376673f6272616e63683d6d6173746572)

Tested against PHP 5.6, 7, 7.1 and 7.2.

Have you ever found yourself thinking:

- My life would be easier if I could programmatically create a doctype string
- I'd be happier if I could parse a doctype string into its component parts
- How can I get a doctype string from a HTML document?
- Is this doctype string that I'm staring at valid?
- I really need get the FPI and URI from this document string and I just don't know how!

Does that apply to you? If so, my goodness are you in luck.

- [Usage](#usage)
    - [Creating](#usage-creating)
    - [Parsing](#usage-parsing)
    - [Getting a doctype string from a HTML document](#usage-extracting)
    - [Creating a `HtmlDocumentType` object from a doctype string](#usage-building)
    - [Validating](#usage-validating)
- [Developing](#developing)
    - [Cloning](#developing-cloning)
    - [Testing](#developing-testing)

Usage
------------------------------------

[](#usage)

### Creating

[](#creating)

```
