Perry Rylance

Personal & Professional blog

DOMForm available for testing

I’ve just pushed up a development version of my new library, DOMForm, which is now available for testing. This library complements my jQuery-like DOMDocument library, which is popular on Packagist with over 5,000 installs to date.

Earlier versions of PerryRylance\DOMDocument had features for populating forms and getting data back, these were dropped in 2.* as that libraries sole focus became jQuery-like PHP DOM manipulation and processing forms was deemed out of scope. This library gives you back this functionality with more standardised behaviour when compared to how the browser’s client side validation works.

The DOMForm test suite.

The intended use case is for when you have some page that renders a form, either for a new resource or populated with data from an existing resource. When you want to process submissions, you can populate the form with the incoming data (eg $_POST). This will handle validation. Once you are happy with the resulting data, you can serialize that from the form safe in the knowledge that it’s been validated client and server side.