Skip to content

johanjanssens/frankenwails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FrankenWails

PHP as a native desktop app — FrankenPHP + Wails, no HTTP server.

FrankenWails embeds the PHP runtime directly inside a native desktop window using FrankenPHP and Wails. There is no HTTP server — the WebView's requests are intercepted by Wails and routed to FrankenPHP in-process.

FrankenWails Demo

Note: This is a companion repo for my FrankenPHP conference talks. It's meant as inspiration and a reference implementation, not a production framework. Feel free to explore, fork, and adapt the patterns for your own projects. Links to talks and slides will be added here.

Talks

How It Works

WebView navigates to /index.php
    → Wails AssetServer intercepts (no TCP, no network)
    → Go http.Handler routes to FrankenPHP
    → PHP executes the script
    → HTML response rendered in WebView

The WebView thinks it's making HTTP requests, but they're just function calls to Go. No port, no socket, no network stack involved.

Quick Start

Build & Run

make php        # Build PHP 8.3 (ZTS, embed) via static-php-cli (one-time)
make env        # Generate env.yaml with CGO flags from the PHP build
make run        # Build the binary + launch the desktop app

The PHP build is cached in dist/.php/ — subsequent runs skip the build if libphp.a exists. To rebuild PHP from scratch:

make php-clean  # Remove cached downloads and build artifacts
make php        # Rebuild
make env        # Regenerate env.yaml

GoLand

Install the EnvFile plugin, then in your Run Configuration enable EnvFile and add env.yaml to load the CGO flags automatically.

Demos

Demo Description
Calculator HTMX form posting to PHP — inline addition without page reload
HTMX Regions Four regions loading concurrently with staggered PHP sleep() delays
Todo SQLite-backed task list with add, complete, and delete
File Browser Browse the local filesystem, navigate directories, preview text files

Project Structure

frankenwails/
├── main.go              # Wails app + FrankenPHP initialization
├── build/php/           # PHP build system (static-php-cli)
├── examples/            # PHP pages (document root)
│   ├── index.php        # Landing page with demo cards
│   ├── calculator/      # HTMX calculator demo
│   ├── htmx/            # Concurrent regions demo
│   ├── todo/            # SQLite todo app
│   └── files/           # Local file browser
├── Makefile
├── go.mod
├── LICENSE.md
└── CLAUDE.md

Requirements

  • Go 1.26+
  • FrankenPHP (built automatically via make php)
  • Wails v2
  • macOS, Linux, or Windows

License

Code is MIT — see LICENSE.md. The talk material is licensed under CC BY 4.0 — free to share and adapt with attribution.

About

PHP as a native desktop app — FrankenPHP + Wails, no HTTP server

Topics

Resources

License

Stars

Watchers

Forks

Contributors