Whim is an experimental programming language inspired by PHP and Hack. As a research project, it explores language ideas by putting them into practice, with the hope that useful ones can contribute to PHP’s future.
Warning
Do not use Whim in production. Every release may add, remove, or redesign any part of the language. Whim has no compatibility promise, release schedule, or production support.
Whim checks types and keeps generic type arguments at run time. It has value-based collections, pattern matching, classes, interfaces, enums, and cooperative tasks.
final readonly class Box<T> {
public function __construct(public T $value) {}
}
function describe(mixed $value): string {
return match ($value) {
$box @ Box<int> => 'integer: ' . $box->value,
$box @ Box<string> => 'text: ' . $box->value,
$_ => 'other',
};
}
write_line!(describe(new Box::<int>(42)));
The whim executable runs source, formats code, prints bytecode, provides a
language server, and manages Git dependencies. The standard library is written
mainly in Whim. It covers async I/O, files, processes, networking, TLS, HTTP,
WebSockets, SQLite, PostgreSQL, dates, encodings, and common data formats.
We also maintain Trifle packages on Codeberg.
Release builds (✅ available, ❌ unavailable):
| Architecture | macOS | Linux (glibc) | Linux (musl) | FreeBSD | Windows (MSVC) |
|---|---|---|---|---|---|
| x86_64 | ✅ * | ✅ | ✅ * | ✅ * | ✅ |
| x86 | ❌ | ❌ | ❌ | ❌ | ❌ |
| AArch64 | ✅ | ✅ * | ✅ * | ✅ * | ❌ |
| ARM | ❌ | ❌ | ❌ | ❌ | ❌ |
| RISC-V | ❌ | ✅ * | ❌ | ❌ | ❌ |
| LoongArch64 | ❌ | ❌ | ❌ | ❌ | ❌ |
| PowerPC64 | ❌ | ❌ | ❌ | ❌ | ❌ |
* marks builds that are not tested in CI. RISC-V builds target 64-bit systems.
CI runs the Rust and Whim test suites on pushes to main and pull requests.
FreeBSD and Linux musl builds run only in the release workflow, without running
tests.
Install the latest release on macOS, Linux, or FreeBSD:
curl --proto '=https' --tlsv1.2 -sSf https://whim.sh/install.sh | bashYou can also download an archive from GitHub Releases. After installation, run:
whim --versionThe container image is available at ghcr.io/carthage-software/whim.
On Windows, download the x86_64-pc-windows-msvc ZIP archive from
GitHub Releases, extract whim.exe, and add its directory to your PATH.
On FreeBSD, install bash, curl, and postgresql18-client before using the
installer. Release builds target FreeBSD 14.4 or later.
To build Whim from source, install Rust 1.99 or later and run:
cargo build --locked --release
./target/release/whim --versionTry Whim in the Whim playground without installing it. The Whim book documents the language, command-line tools, package manager, and standard library. Start with Installation, then write Your First Program.
Run the Rust and Whim test suites with:
cargo test --locked --workspace --all-features
cargo build --locked --release --bin whim
./target/release/whim tests/run.whimThe Justfile provides shorter development commands.
Whim accepts issue reports but not pull requests. Read CONTRIBUTING.md before opening an issue. Follow SECURITY.md to report a security problem.
Use Whim under either the Apache License, Version 2.0 or the MIT License.