Hello,
Please use htmlspecialchars with 'url' in that case:
$docx->addLink('Link to Google', array('url'=> htmlspecialchars('http://www.domain.com?test=111&attr=content')));
We have opened a task to apply htmlspecialchars automatically to 'url' option in addLink in the next release of phpdocx.
Regards.