pphlx
v1.1.7
Published
High-performance Monolithic Web Compiler and PHP Hydration CLI
Downloads
3,426
Maintainers
Readme
PPHLX Compiler
Official Node.js CLI launcher for PPHLX. Includes pre-compiled native binaries and WebAssembly fallback to run seamlessly across Windows, macOS, and Linux without external compiler dependencies.
Features
- 🚀 High-performance compiler: Powered by Go and compiled natively.
- ⚡ WebAssembly (WASI) powered: Run anywhere Node.js runs without native compiler dependencies.
- 📦 Zero runtime in production: The generated output is standalone, with no node modules.
- 🧩 Component-based layout: Build components using your favorite frontend workflows.
- 🔥 Hot reload: Fast development server built-in.
- 🌍 Cross-platform: Instant startup on Windows, macOS, and Linux.
- 🐘 Generates pure PHP: Easily host your builds on any cheap PHP web hosting server.
Quick Start
Get your project up and running in seconds:
Recommended (1-Line Project Setup)
npm create pphlx@latest my-app
cd my-app
npm install
npm run devManual Setup (Existing Project)
Install PPHLX locally:
npm install pphlxInitialize project configuration & template scaffolding:
npx pphlx initStart local development server (with hot reload and background PHP routing):
npm run devVerify template diagnostics:
npm run checkBuild and preview your production package:
npm run build npm run preview
Usage
PPHLX compiles your components into dependency-free, production-ready PHP pages. The generated output requires no Node.js, JavaScript runtime, or PPHLX framework in production.
By default, the compiler looks for a configuration file (pphlx.config.json or pphlx.config.mjs) in the root of your project directory.
package.json Scripts
Upon installation, PPHLX automatically configures the following scripts in your project's package.json so you do not need to configure them manually:
{
"scripts": {
"dev": "pphlx dev",
"start": "pphlx dev",
"watch": "pphlx watch",
"build": "pphlx",
"preview": "pphlx preview",
"check": "pphlx check"
}
}Then simply use the corresponding npm run <command>:
npm run dev: Launches active hot-reload compilation and dev server.npm run check: Validates template syntax and component imports.npm run build: Compiles layouts and assets into standalone.phpproduction files.npm run preview: Starts a local PHP server pointing directly to your compiled production directory.
Multi-Target Compilation
PPHLX supports compiling your application to multiple target formats. By default, it compiles to standard .php files. You can configure this inside pphlx.config.json or override it on the fly using CLI flags.
Configuration (pphlx.config.json)
To configure a default target, add the "output" block:
{
"srcDir": "src",
"outDir": "dist",
"output": {
"target": "desktop",
"goos": "darwin",
"goarch": "arm64"
}
}target:"php"(default),"standalone"(headless Go server binary),"desktop"(native desktop GUI app),"android"(scaffolded Android Studio Gradle project),"ios"(scaffolded Swift Xcode project),"ssg"(static HTML/JS/CSS), or"blade"/"twig"(framework-native template views).goos/goarch: (Optional) Target cross-compilation OS (e.g.linux,darwin,windows) and architecture (e.g.amd64,arm64) when compiling standalone or desktop binaries.
CLI Overrides
Pass the --target (or -t) flag to temporarily customize the output target during a build:
# Compile to a Standalone Go Binary
npx pphlx build --target standalone
# Compile to a Native Desktop App
npx pphlx build --target desktop
# Compile to an Android Gradle project
npx pphlx build --target android
# Compile to an iOS Xcode project
npx pphlx build --target ios
# Compile to Static HTML (SSG)
npx pphlx build --target ssg
# Compile to Laravel Blade templates
npx pphlx build --target blade
# Compile to Symfony Twig templates
npx pphlx build --target twigProject Links
- Website: pphlx.org
- GitHub Repository: github.com/pphlx/pphlx
- Discord Community: Discord Server
