Below is our function to add link to a placeholder -
$fomattedURLWordFragment = addUrlLink($value,$templateDocx,$placeHolderName);
$templateDocx->replaceVariableByWordFragment(array('placeHolderName' => $fomattedURLWordFragment), array('type' => 'inline', 'target' => 'document'));
function addUrlLink($inputText,$templateDocx,$placeHolderName){ Â Â
   echo "In addUrlLink";
  $docx = new CreateDocx();
  $wf = new WordFragment($docx);
   //preg_match('/<link>(.*?)<\/link>/', $inputText, $matches);
  Â
   $text = array();
   //print_r($matches); //die();
   //$url = $matches[1]; // This will contain 'www.hdfcfund.com'
   $url = 'www.hdfcfund.com';
   $link = new WordFragment($docx);
   //$link->addLink($matches[0], array('url'=> $url, 'color' => '0000FF', 'u' => 'single'));
   $link->addLink($inputText, array('url'=> $url, 'color' => '0000FF'));
   $text[] = $link;
  Â
   //print_r($text); //die();
   $wf->addText($text, array('font' => 'Cambria', 'fontSize' => 6.5));
  return $wf;
}
This does not add link to the placeholder variable. Please correct the above code.