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.

Leave a Reply