phpHtmlLib is an open source PHP library that I have used on a number of projects over the years.   Because I have found it very useful, when I started working on WordPress projects, I was frustrated by the amount of code that had to be developed to achieve some functionality, particularly as it related to forms.


When I started the wp-SwimTeam plugin I knew it would be forms intensive.  A swim  team requires a tremendous amount of data to operate – names, addresses, birth dates for the swimmers and parents, then stroke, distance, time, date, location, heat, lane, place, etc. for actual swim meets and events – it a lot of information to enter and manage.  I had zero interest in creating and validating all of the forms in the traditional WordPress way so I decided to adapt phpHtmlLib to be a WordPress plugin.

The plugin effort wasn’t as difficult as I initially expected.  Once I settled on a couple of database options to track the location and version of phpHtmlLib, it pretty much worked because the library itself doesn’t actually do anything once WordPress knows about it.  However, once WordPress knows about it, other plugins can use the library which is exactly what wp-SwimTeam does.

Source Code

The original author of phpHtmlLib has since turned it into a full MVC framework with the 3.x release.  The full MVC is overkill for a WordPress plugin and a number of the 2.x features were not migrated forward into 3.x.

The phpHtmlLib WordPress plugin is based on the 2.x thread which (a) I have commit rights to and (b) continues to support PHP4 which the 3.x thread does not.  Continued support for PHP4 is becoming less of an issue as most ISPs now support PHP5 easily and WordPress itself is rumored to be going PHP5 only after the 3.2 release.

So what can you do with phpHtmlLib?

The phpHtmlLib library contains a set of PHP classes and library functions to help facilitate building, debugging, and rendering of XML, HTML, XHTML, WAP/WML Documents, and SVG (Scalable Vector Graphics) images as well as complex html Widgets.  These classes, library functions and widgets can be used to build other WordPress plugins.

3 thoughts on “phpHtmlLib

  1. Hi Mike,

    I’m Andrew from WebHostingHub. We are doing Spanish translations of useful plugins in order to ease the people from Hispanic community and we consider that your phpHtmlLib plugin that we found at is very interesting.
    Would it be ok with you, if I translate it into Spanish?

    I hope I’ll hear from you soon.

    Kind regards

    Andrew Kurtis

  2. Hello Mike,

    Week ago I have asked for your permission to translate your phpHtmlLib plugin in Spanish and I didn’t hear any from you since. I hope that you will find time to provide the reply, because we believe that the translation would be of a great use.

    All the best,

    Andrew Kurtis

    • Sorry for the delay, I was traveling last week and let a few things pile up. I am not opposed to what you propose but I am curious as to why you want to do it? The phpHtmlLib code is pretty old and was never set up for translation. In fact, the code was never intended to be for a plugin, it was a general purpose PHP library that I had used on another project that I wanted to use for wp-SwimTeam. I fear that changing the core of the library to use the WordPress translation facilities would render the library useless for general purposes. I have no idea if anyone is still using the library or not – at one time the support forum for it was very active but I haven’t seen anything new in a while.

Leave a Reply