Stamp Template Engine

The Stamp Template Engine is a string based, logic-less template engine. This means 100% separation between PHP and HTML.
Working with StampTE is like playing with a paper model, cut out parts and glue them together (a Stamp is also an appropriate metaphor, hence the name of the lib!).


2.3.1: Added u modifier for better UTF-8 support in regular expression.
2.3.0: UTF-8 support, PHP 7 compatibility, improved HTML5 document template.


: Released version 2.3.2
: Released version 2.3.1
: Released version 2.3
: Released version 2.2.2
: Migrated to new server.
: StampTE 2.2.1 has been released, performance improvement.
: Updating documentation
: StampTE 2.2 has been released!

Get started!

Let's begin with a practical example. This is how you make a price list for an Italian restaurant using StampTE:


cut:pizza -->
        <!-- /
cut:pizza -->

Let's add some data:

    $data = array(
'Margherita' => '7.00',
'Funghi' => '7.50',
'Tonno' => '8.00'

The PHP logic:

    $htmlDocument StampTE::createHtml5Utf8Document();

$priceList = new StampTE($template);
$data as $name=>$price) {
$pizza $priceList->getPizza();


The resulting HTML:

    <!DOCTYPE html>
meta charset="UTF-8">

As you can see in the HTML output above the createHtml5Utf8Document() convenience method creates a valid HTML5 document skeleton for you. We then create a price list from the template string. The resulting output looks like this:


How it works

It's easy to see how this template engine works by just reading the example. StampTE simply converts the regions marked in the template to objects you can manipulate. It cuts out the regions and you can then reshuffle them in your HTML.


It's Clean. No more PHP in your HTML.

This also means: toll free template upgrades. Templates no longer have to be converted (insert PHP tags etc...) so you can simply swap files to upgrade your design.

Because templates do not have to be converted anymore you can show the live templates to your customer in the browser. Templates become plug-and-play. This also makes it a lot easier to exchange templates.

Finally, this approach makes it easy for different teams to work together (design team and development team).

No new syntax

Stamp Template Engine does not require you to learn a new syntax. Instead, Stamp uses markers, HTML comments. These markers are used to identify regions in the HTML template. Most template engineers already use such markers for readability, StampTE makes them even more useful!
Templates become self-documenting and more readable.

StampTE Automatically escapes strings for unicode (X)HTML documents. So no longer have to worry about XSS!


Download the latest version of Stamp Template Engine.

Stamp TE is licensed new BSD. Download Stamp TE v 2.3.2


The GSPP18 complies with GDPR laws but goes much further. GSPP18 is a framework and system designed to respect your privacy in a much more fundamental way. This website now implements the new GSPP18 guidelines. GSPP18 consists of the following features (since this is a generic privacy framework, we refers to the site owner or owners):

  • We respect your privacy
  • We do not log ANY information about you (not even your IP address)
  • We do not place ANY cookies, not a single one
  • We do not track you using localStorage
  • We do not track you using in-browser databases
  • We do not track you using 3rd-party cookies
  • We do not track you using images, tracking pixels, flash, (i)frames or Java Applets
  • We do not track you in any way
  • We do not allow our website to establish connections with other sites without your knowledge
  • We offer an encrypted connection in some way or another
  • We are not responsible for any privacy issues on linked websites but we ensure that you can download the main content from this website and therefore there should be no need to visit external websites for that reason
  • If for some reason you believe we have personal information about you, you can contact us at: gabordemooij at gaborsoftware dot nl and file a request to remove that personal data from our systems

If you feel this website breaks one of the GSPP18 guidelines please inform us as soon as possible. You can apply the GSPP18 to your own website by copying the text above and replace the e-mail address of the webmaster with your own.

The author and BDFL of StampTE, Gabor de Mooij rejects the concept of Code of Conduct entirely. As of 1 April 2018, Gabor Software actively promotes the GSFS18 standard (Gabor Software Free Speech 2018 Standard). As part of this standard, StampTE rejects the notion of a Code of Conduct.


  • We do not impose any limit on your freedom of speech
  • You have the right to be a complete asshole
  • You can say anything you like using the communications offered by this website (for instance e-mail, contributed content and so on)
  • You are free to insult me or others as much as you like
  • If you feel insulted somehow by the content hosted by this website, we recommend to click on the close button and never visit this website again in the future