Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

[WIP] Templating in PHP 👨‍💻

An example to go along with a guest lecture at Madison Area Technical College's Advanced PHP class.

Comparing standard PHP templating practices to Twig.

Setup 🤓

  1. Make sure composer is installed globally or for this project.
  2. Run composer install to install dependencies.
  3. In terminal run php -S localhost:8080 to create a local PHP server (or whatever port you like).
  4. The home page will give you the twig version and this will give you the vanilla PHP version (which currently simulates a scripting "attack" 🙀😱).

The Point of This Execise

To show folks some of the differences and baked-in goodies one gets when using something like twig for templating.

This is using the standard "todo app" concept as a starting point.

Maybe some Resources 🤷‍:

Additions for the [WIP]

  • Add in a couple other templating options (e.g. blade, handlebars, etc.) to explore the similarities and differences.
  • Hook templates up to an API, database, or todo app to show how to work with an API or database.


Testing PHP and Twig templates for MATC Advanced PHP class



No releases published


No packages published