Skip to content

Releases: mpyw/gophper

Release list

v0.1.1

Choose a tag to compare

@github-actions github-actions released this 10 Oct 20:29
Immutable release. Only release title and notes can be modified.
a2e9bd8

This release adds examples and rewrites the README. The library and the CLI work exactly as in v0.1.0.

What changed

Area Change
Examples A new module with three runnable examples. See below.
README Usage comes first: as a library, then as a tool. A full reference follows it.

Examples

Example What it shows
fibonacci PHP calls a Go function through Options.Functions. It compares recursive Fibonacci in Go and in PHP. Go is about 90 times faster at F(30).
todos A small Laravel 13 app with Blade and SQLite. It has no JavaScript build.
todos-serve Serves todos over HTTP with server.NewHTTPHandler
todos-fcgi Serves todos with server.NewFastCGIServer, behind FrankenPHP. Its mise.toml installs FrankenPHP.

What is inside

Nothing changed here since v0.1.0.

Component Version
PHP 8.6.0RC3
gophper-wasm v0.2.3
wazero v1.12.0
Go 1.27.1

Install

Way How
A release binary Download the archive for your OS and CPU below. checksums.txt has their SHA-256.
mise mise use -g github:mpyw/gophper@0.1.1
From source CGO_ENABLED=0 go install github.com/mpyw/gophper/cmd/gophper@v0.1.1
As a library go get github.com/mpyw/gophper@v0.1.1

Full Changelog: v0.1.0...v0.1.1

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 10 Oct 04:26
Immutable release. Only release title and notes can be modified.
9f7990f

The first release of gophper. It runs PHP from Go with no cgo.

gophper runs php-src, compiled to WebAssembly by gophper-wasm, on wazero.
It is the real Zend Engine, so the language behaves exactly like PHP.

Warning

This is an experiment. The API will change.
The PHP inside is 8.6.0RC3, a release candidate.

What is inside

Component Version
PHP 8.6.0RC3
gophper-wasm v0.2.3
wazero v1.12.0
Go 1.27.1

gophper --version prints all of them. Put it in a bug report.

Install

Way How
A release binary Download the archive for your OS and CPU below. checksums.txt has their SHA-256.
mise mise use -g github:mpyw/gophper@0.1.0
From source CGO_ENABLED=0 go install github.com/mpyw/gophper/cmd/gophper@v0.1.0
As a library go get github.com/mpyw/gophper@v0.1.0

Archives cover macOS, Linux and Windows, each on amd64 and arm64.

Highlights

Area What you get
gophper php The php CLI. A symlink named php works too. Signals reach pcntl handlers, so artisan queue:work stops cleanly.
gophper serve Serves a PHP app over HTTP or HTTPS, with Let's Encrypt for --domain. Workers keep opcache warm.
gophper fcgi A FastCGI server behind nginx, like php-fpm
Extensions curl, pgsql, PDO and more are built in. gd, intl, redis, sodium, zip and others load at runtime.
Host access Processes (proc_open and the rest), sockets, DNS, flock and file permissions go to the host
Go API Engine runs the CLI or CGI SAPI. server gives an http.Handler and a FastCGI server. PHP can call Go functions.
Windows Supported, with drive paths at /c, /d and so on. See the README's Windows section.

The sandbox

From Go, PHP gets nothing of the host unless Options says so.

Field Off by default
FS No file system
Processes proc_open and the rest fail
Network TCP, UDP and DNS fail
MemoryLimit Caps PHP's memory. memory_limit cannot lift it.

wazero sees only a ctx's deadline and cancellation, never its values.
So its experimental settings in a caller's ctx cannot get around these fields.

Known limits

Topic Status
Speed About 3.3 times slower than native PHP. There is no JIT.
First run Compiling PHP to machine code takes about 12 s on an Apple Silicon Mac. It is cached per user after that.
Fibers Throws Fibers are not supported on this platform
pcntl_fork() Fails

License

gophper is under the MIT License.
A binary also contains PHP, its libraries and Go modules, each under its own license.
To distribute one, pass on what gophper licenses prints.

See the README for everything else.