baremetalphp / baremetalphp
A new project built with Bare Metal PHP
Package info
github.com/baremetalphp/BareMetalPHP
Language:Hack
Type:project
pkg:composer/baremetalphp/baremetalphp
Requires
- php: >=8.0
- baremetalphp/framework: ^0.2.0
README
A modern PHP framework with a Go-powered application server
BareMetalPHP is a lightweight, high-performance PHP framework designed around a simple idea:
PHP should run fast by default β without FPM, without heavy stacks, and without hacks.
Instead of relying on traditional PHP-FPM, BareMetalPHP includes an optional Go application server that manages persistent PHP workers. This provides:
- Huge performance gains over cold-start PHP
- True parallelism (fast + slow worker pools)
- Zero-config hot reload
- Static asset offloading
- A fast, modern DX similar to Node, Go, or Rust
If you want Laravelβs experience but not Laravelβs overhead, this is your framework.
β¨ Key Features
π¨ 1. Go-Powered App Server (the BareMetal Runtime)
BareMetalPHP includes a Go runtime that functions like a lightweight alternative to Swoole or Laravel Octane:
- Persistent PHP worker pool
- Fast + slow request classification
- Hot reload for PHP & routes
- Static file serving
- Efficient GoβPHP bridge protocol
Enable it with:
APPSERVER_ENABLED=true
Start it with:
php mini go:serve
Dry run:
php mini go:serve --dry-run
π― 2. A modern, minimal PHP framework
BareMetalPHP provides:
- Simple router
- Controller + method resolution
- PSR-7-style Request & Response
- Lightweight dependency injection container
- View layer
- Migrations + SQLite testing utilities
miniCLI (generators, migrations, test tools)
It is intentionally small, readable, and fast.
βοΈ 3. Fully tested
The framework is covered by a deterministic test suite:
- Routing, container, HTTP kernel
- Database + migrations + rollback
- Go app server installer
- Go -> PHP worker bridge
Run all tests:
vendor/bin/phpunit
π§° Installation
Create a new BareMetalPHP project:
composer create-project baremetalphp/baremetalphp my-app
cd my-app
Run the built-in PHP server:
php mini serve
Install the Go application server
php mini go:install go mod tidy php mini go:serve
Default Go server URL:
http://localhost:8080
βοΈ Configuration (config/appserver.php)
return [ 'enabled' => env('APPSERVER_ENABLED', false), 'fast_workers' => (int) env('APPSERVER_FAST_WORKERS', 4), 'slow_workers' => (int) env('APPSERVER_SLOW_WORKERS', 2), 'hot_reload' => (bool) env('APPSERVER_HOT_RELOAD', true), 'static' => [ ['prefix' => '/assets/', 'dir' => 'public/assets'], ['prefix' => '/build/', 'dir' => 'public/build'], ['prefix' => '/css/', 'dir' => 'public/css'], ['prefix' => '/js/', 'dir' => 'public/js'], ['prefix' => '/images/', 'dir' => 'public/images'], ['prefix' => '/img/', 'dir' => 'public/img'], ], ];
The Go installer generates a matching go_appserver.json automatically.
π§© Architecture Overview
ββββββββββββββββββββββββββββββββ
β Go HTTP Server β
β - static files β
Request ββββββΆβ - routing fallback ββββββββββββ
β - hot reload watcher β β
ββββββββββββββββββββββββββββββββ β
βΌ
ββββββββββββββββββββββββββββ
β PHP Worker Pool β
β (persistent processes) β
ββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββ
β BareMetalPHP Framework β
β - routing β
β - container β
β - controllers β
β - views β
β - database/migrations β
ββββββββββββββββββββββββββββ
π¦ Commands
php mini serve php mini make:controller Foo php mini make:migration create_users php mini migrate php mini migrate:rollback php mini install:go-appserver php mini go:serve php mini go:serve --dry-run
π Version 0.2.0 Release Notes
- Go application server is now a first-class feature
go:servecommand addedgo:installscaffolding generator addedgo_appserver.jsongenerated from PHP config- Persistent PHP worker bridge implemented
- Better migration rollback logic
- Higher overall test coverage
π£ Roadmap
- Zero-downtime worker recycling
- WebSockets via Go
- Cache subsystem
- Async jobs via Go sidecar
- API rate limiting
- Events + Subscribers
- Optional queue runner
π€ Contributing
Contributions, ideas, and issues are welcome.
π License
MIT