enhancements to the php code to support doc typing