The WordML got stripped out, trying again.
$footer_html = "This is some text or html for the footer. Page PAGE_NUM of TOTAL_PAGES";
$footer = $docx->embedHTML($footer_html, array('rawWordML' => true, 'target' => 'defaultFooter'));
$footer = str_replace('PAGE_NUM', '<w:fldSimple w:instr="PAGE"/>', $footer);
$footer = str_replace('TOTAL_PAGES', '<w:fldSimple w:instr="NUMPAGES"/>', $footer);
$footer_fragment = $docx->createWordMLFragment(array($footer));
$docx->addFooter(array('default' => $footer_fragment));