PHPackages                             bitforge/thorm - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. bitforge/thorm

ActiveLibrary[Framework](/categories/framework)

bitforge/thorm
==============

PHP-first UI framework that compiles a declarative DSL to a small browser runtime via a shared IR.

v0.1.0-alpha.1(1mo ago)142↑1400%Apache-2.0HTMLPHP &gt;=8.1

Since Jan 1Pushed 5d agoCompare

[ Source](https://github.com/scarpelius/thorm)[ Packagist](https://packagist.org/packages/bitforge/thorm)[ Docs](https://thorm.dev)[ RSS](/packages/bitforge-thorm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

Thorm
=====

[](#thorm)

PHP-first DSL for describing reactive UIs that compile to a small JavaScript runtime. Build views with simple PHP functions, emit an intermediate representation (IR), and let the runtime handle reactivity, events, routing, and effects in the browser.

Status
------

[](#status)

Thorm is currently in pre-alpha / developer preview.

- APIs may change without backward compatibility
- package structure and build flows may change
- suitable for evaluation, experimentation, and early integration work

Project docs
------------

[](#project-docs)

- [ROADMAP.md](ROADMAP.md): Current project direction, priorities, and release phases.
- [CONTRIBUTING.md](CONTRIBUTING.md): Current contribution policy for the public repo.
- [SECURITY.md](SECURITY.md): How to report security issues privately.

Installation
------------

[](#installation)

Install the framework with Composer:

```
composer require bitforge/thorm:^0.1@alpha
```

Because Thorm is currently in pre-alpha / developer preview, Composer installation requires an explicit alpha version constraint.

If you want to explore the framework itself, study the examples, or work directly from the source repository, clone the repo and install its local dependencies:

```
git clone https://github.com/scarpelius/thorm.git
cd thorm
composer install
```

If you want to consume a local checkout from another PHP project, use a Composer `path` repository:

```
{
  "repositories": [
    {
      "type": "path",
      "url": "../Thorm"
    }
  ],
  "require": {
    "bitforge/thorm": "*"
  }
}
```

Project layout
--------------

[](#project-layout)

- `src/php/functions.php`: Public DSL surface (state, el, attrs, on, repeat, route, component, effects, http, etc.).
- `src/php/Render.php`: Builds the shared IR and can render server-side HTML from that IR.
- `src/php/BuildExample.php`: Writes generated example output to `public/examples//`.
- `src/php/IR/*`: IR node definitions for atoms, expressions, actions, effects, and DOM nodes.
- `assets/index.tpl.html`: HTML template used during example generation (`{$title}`, `{$containerId}`, `{$iruri}` placeholders).
- `public/runtime/**`: Browser runtime (core, primitives, utils, devtools).
- `examples/*.php`: End-to-end samples that generate pages under `public/examples/`.
- `cli/watch.sh`: Dev helper that watches the tree, reruns touched example PHP files, and syncs runtime assets.

Requirements
------------

[](#requirements)

- PHP 8.1+
- Composer for autoloading via `vendor/autoload.php`
- A static file server to view the generated pages (e.g., `php -S localhost:8000 -t public`)

Quick start
-----------

[](#quick-start)

1. Install the package in your PHP project:

```
composer require bitforge/thorm:^0.1@alpha
```

2. To explore the bundled examples from this repository instead, clone the repo and install local dependencies:

```
git clone https://github.com/scarpelius/thorm.git
cd thorm
composer install
```

3. Run an example to generate IR + HTML in `public/examples//`:

```
php examples/counter.php
```

4. Serve the `public/` folder and open `http://localhost/examples/counter/`.

To regenerate on changes, use the watcher (auto-runs example scripts and syncs runtime):

```
bash cli/watch.sh
```

(Use `WATCH_MODE=poll` on filesystems without inotify.)

Explore the repository
----------------------

[](#explore-the-repository)

If you are learning Thorm for the first time, the repository is the best place to study the framework surface, examples, runtime, and generated output together.

- `examples/*.php` contains end-to-end sample apps
- `src/php/**` contains the DSL, renderer, and IR classes
- `src/runtime/**` contains the browser runtime
- `assets/index.tpl.html` shows the HTML template used during example generation

Authoring UIs in PHP
--------------------

[](#authoring-uis-in-php)

Build views with the DSL from `Thorm\` (autoloaded via composer files):

```
