Version: v0.5.0 - Beta.  We welcome contributors & feedback.  THanks!
THT Hypertext Toolkit
THT is a language for web development.
It adds a modern, secure interface around PHP while remaining fast & easy to use.

You Might Like THT If... 

A Quick Look 

You don’t need to know PHP to use THT.

// THT has a familiar JavaScript-like syntax.
let colors = ['red', 'blue'];

// Built-in types have methods.
colors.push('yellow');

// The standard library is organized into modules.
Response.sendPage({
    title: 'Primary Colors',
    body: bodyHtml(colors),
});

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

    <h1>Primary Colors</h1>
    <ul>
    :: for (color in colors) {
        <li>{{ color.toUpperCase() }}</li>
    :: }
    </ul>
}

Read More:  Syntax Cheat Sheet  |  Full Language Tour

Built on PHP (The Good Parts)

THT keeps the same convenient workflow of PHP:
Easy Setup
PHP is available on every major web host and OS. Using it with Apache requires little (if any) system administration.
Simple Routes
Creating a page can be as simple as adding a new .tht file. Pages automatically get clean URLs (e.g. "blog.tht" becomes "/blog").
Save & Refresh
No build steps or background tasks. When you update your code, it's automatically transpiled to PHP (and cached for performance).
Atomic Requests
State and data are automatically cleaned up after every request.

New 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.
  • Friendly Errors. The error pages are designed to be easy to read, with full stack traces.
  • Syntax Shortcuts. Optional syntactic sugar makes 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.
  • UTF-8 Support. String functions work with UTF-8 by default.

Web Framework 

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

Security 

By default, THT defends against the most common security risks, so you can spend more time building the functionality of your app.

Performance 

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.

THT itself is a safe choice, performance-wise:

In a basic “Hello World” benchmark, THT is 6x faster than Laravel (1000 req/s vs 160 req/s) and uses 60% less memory (0.8 MB vs 2 MB).

On a MacBook Pro, the core THT test suite (770 tests) finishes in 18 milliseconds. This includes a full range of operations for control flow, data structures, file access, and database access.

The THT bundle is about 50x smaller than Laravel and its dependencies (230 KB vs 16 MB, zipped).

It also has built-in performance tools:

Give It a Try 

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