PHPTAL is a fast, safe, XML-based template engine for XHTML and HTML5. It implements Zope's Template Attribute Language, which has clean, concise syntax that is compatible with XML tools (no custom ugly tags), and template source files can even be previewed in Web browsers or opened in WYSIWYG editors. Templates are compiled to PHP and cached, giving great performance and taking advantage of PHP accelerators. PHPTAL by default ensures well-formed output and escapes XML-unsafe characters everywhere, which means that your pages can be completely safe against HTML-injection (XSS) without great effort. It features fine-grained caching of output, pre- and post- filters, internationalization via gettext or custom backend, creation of custom template attributes and expressions, and templates loaded from non-standard sources (e.g. databases). It supports UTF-8 well, is easy to integrate and redistribute with PHP frameworks and applications, and has an object-oriented design and a comprehensive unit test suite.