Version: v0.6.1 - Beta.  We welcome contributors & feedback.  THanks!
THT Hypertext Toolkit
THT is a language that keeps the
good parts of PHP and fixes the rest.
THT fixes many aspects of PHP (diagram)

A Quick Look 

// Familiar variable and List syntax.
$colors = ['red', 'blue', 'green'];

// New JSON-style syntax for Maps
$colorHex = {
    red:   '#FF0000',
    green: '#00FF00',
    blue:  '#0000FF',

// Built-in types have methods using
// the mainstream 'dot' syntax.

// Extra parens aren't needed.
if $colors.length() > 3 {

// The standard library is organized
// into modules.
    title: 'Colors',
    body: bodyHtml($colors),

// Template Functions let you organize
// your output (views) however you like.
// (e.g. by component, module, file, etc.)
template bodyHtml($colors) {

    -- foreach $colors as $c {
        <li>{{ $c.toUpperCaseFirst() }}</>
    -- }

Read More:  Syntax Cheat Sheet  |  Full Language Tour

THT Keeps the Good Parts of PHP

Despite its flaws, PHP has a few unique strengths that has made it one of the most popular languages in the world.

Easy Setup
PHP is available on every major web host and OS. Using it with Apache is fast out of the box, with virtually no system administration.
Simple Routes
In PHP, every file has a URL. THT automatically provides clean URLs (e.g. "/myBlog.tht" becomes "/my-blog"), and blocks access to private code.
Atomic Requests
State and data are automatically cleaned up after every request. This "share nothing" approach enables horizontal scaling and simplifies your app flow.
Web Focused
PHP is a web language at its core. THT embraces this even further by building in web security and framework features.
Batteries Included
PHP comes with a massive library of convenient functions. THT completely re-organizes this library and makes it more consistent.

Key THT Features

Organized Library.
PHP's massive library (5,000+ functions) is curated and organized into modules & classes.

Lists & Maps.
PHP arrays are split into clear List and Map types.

Module System.
File inclusion is supported via modules with built-in autoloading. No verbose namespaces.

Concise Syntax.
Optional syntax shortcuts make common patterns more convenient. (e.g. ||= for default assignment.)

Cleaner Code.
A compile-time format checker helps you write code that is easier to read and maintain.

Unicode Support.
String functions work with UTF-8 by default.

Friendly Errors.
The error pages are easy to read and have full stack traces.

Read More:  How THT Compares to PHP

Web Framework Included 

THT includes many tools that are useful for modern web development:

Built-In Security 

By default, THT defends against the most common security risks.

These safeguards are integrated into the language, providing better protection than if they were imported from a third-party library.


TypeStrings are used to prevent injection attacks, which are considered the #1 security vulnerability on the internet.

They can not be mixed with (unsafe) regular strings. Dynamic values are inserted via placeholders.

// SQL Queries
$q = sql'select name from users where id = {}';

// URLs
$u = url'/users?sort={}'.fill('desc');

// System Commands
$c = cmd'chmod {perms} {file}';
$c.fill('755', 'my_file.conf');

Other Safeguards

Read More:  All Security Enhancements


Out of the box, PHP is more than fast enough for most apps.

PHP 7 already offers major speed gains, but you can benefit even more by using an opcode cache like APC.

On a MacBook Pro, the core THT test suite (800 tests) finishes in 13 milliseconds.

It is also compact. The combined THT transpiler and runtime is only 180 KB (in comparison, Laravel is 16 MB).

THT also has built-in performance tools:

How It Works 

Give It a Try 

THT is still in Beta, but if you’d like to try it out, it’s already suitable for most small-to-medium web apps.