<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//Create a Word fragment with an image to be inserted in the header of the document
$imageOptions = array('src' => '../../img/image.png', 'dpi' => 300);
$default = new WordFragment($docx, 'defaultFooter');
$default->addImage($imageOptions);
$first = new WordFragment($docx, 'firstFooter');
$first->addText('first page footer.');
$even = new WordFragment($docx, 'evenFooter');
$even->addText('even page footer.');
$docx->addFooter(array('default' => $default, 'first' => $first, 'even' => $even));
//add some text
$docx->addText('This is the first page of a document with different footers for the first and even pages.');
$docx->addBreak(array('type' => 'page'));
$docx->addText('This is the second page.');
$docx->addBreak(array('type' => 'page'));
$docx->addText('This is the third page.');
$docx->createDocx('example_addFooter_2');
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//Create a Word fragment with an image to be inserted in the header of the document
$imageOptions = array('src' => '../../img/image.png', 'dpi' => 300);
$footerImage = new WordFragment($docx, 'defaultFooter');
$footerImage->addImage($imageOptions);
$docx->addFooter(array('default' => $footerImage));
//add some text
$docx->addText('This document has a footer with just one image.');
$docx->createDocx('example_addFooter_1');
<?php

/**
 * Create a DOCX file. Footer example
 *
 * @category   Phpdocx
 * @package    examples
 * @subpackage easy
 * @copyright  Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
 *             (http://www.2mdc.com)
 * @license    LGPL
 * @version    2.0
 * @link       http://www.phpdocx.com
 * @since      File available since Release 2.0
 */
require_once '../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$paramsFooter = array('font' => 'Times New Roman');
$docx->addFooter('Footer. Times New Roman font', $paramsFooter);
$docx->createDocx('example_footer');
<?php

/**
 * Create a DOCX file. Header and footer with font styles
 *
 * @category   Phpdocx
 * @package    examples
 * @subpackage intermediate
 * @copyright  Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
 *             (http://www.2mdc.com)
 * @license    LGPL
 * @version    2.0
 * @link       http://www.phpdocx.com
 * @since      File available since Release 2.0
 */
require_once '../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$paramsHeader = array('name' => '../files/img/image.png', 'jc' => 'right', 'textWrap' => 5, 'font' => 'Arial');
$docx->addHeader('Header Arial', $paramsHeader);
$paramsHeader = array('font' => 'Times New Roman');
$docx->addHeader('Header Times New Roman', $paramsHeader);
$paramsFooter = array('pager' => 'true', 'pagerAlignment' => 'center', 'font' => 'Arial');
$docx->addFooter('Footer Arial', $paramsFooter);
$docx->createDocx('example_header_and_footer');