A Quick Look
You don’t need to know PHP to use THT.
See the Syntax Cheat Sheet or full Language Tour.
Built on PHP (The Good Parts)
THT keeps the parts of PHP that make its workflow quick & easy to understand:
Creating a new page URL can be as simple as adding a new
.tht file. Unlike PHP, the extension is not part of the URL.
When you update your code, it’s automatically transpiled to PHP (and cached). No extra build steps are necessary.
State and data are automatically cleaned up after every request.
See How THT compares to PHP, for a full comparison.
THT includes many (optional) tools that are useful for modern web development:
- Router for clean URLs (e.g. “/blog/123/top-ten-things”)
- Template system that supports embedded THT code
- Base stylesheet with reset styles, grid system & SVG icons
- Litemark parser for Markdown-style content
- JCON for human-friendly JSON-style configuration
- Session support with secure defaults & flash data
- Database module with CRUD methods & parameterized queries
- Cache module for performance tuning
By default, THT defends against the most common security risks.
Some of the security enhancements include:
- Introduces LockStrings to prevent injection attacks.
- Template variables are automatically escaped. (XSS)
- High-risk PHP commands are restricted. (e.g.
- Sandboxing of file functions
See all security enhancements.
Out of the box, PHP is more than fast enough for most apps. But you can benefit even more by the speed gains in PHP 7, or an opcode cache like APC.
On a MacBook Pro, the THT test suite (700 tests) finishes in 75 milliseconds. This includes the full range of file and database operations.
THT provides a Perf module to identify any performance bottlenecks in your app (usually database calls).
You can use the Cache module to eliminate the most common performance hits.
You Might Like THT If...
- You appreciate the convenience & simplicity of PHP, but don’t want to deal with the idiosyncrasies and risks that come with it.
- You are building a web app that runs on a shared web host or single server (e.g. content site, home page, blog, forum, etc.)
- You want to learn web development with a language that is easy to learn and encourages good patterns and habits.
Give It a Try
THT is still in Beta, but if you’d like to try it out, it’s already capable of making basic web apps.