Installation
Install script
On Linux and macOS:
curl -fsSL https://stirphp.github.io/core/install.sh | shOn Windows, in PowerShell:
irm https://stirphp.github.io/core/install.ps1 | iexThe script picks the build for your platform, downloads the latest release, checks it against the release's SHA256SUMS and installs sphp without admin rights: to ~/.local/bin on Linux and macOS, and to %LOCALAPPDATA%\Programs\sphp\bin on Windows, where it also adds that directory to your user PATH. On Linux and macOS, it tells you what to add to your shell profile if the directory isn't on your PATH.
| Variable | |
|---|---|
SPHP_VERSION | A version such as 0.1.1, or nightly (default: the latest release) |
SPHP_INSTALL_DIR | Where to put sphp |
SPHP_NO_MODIFY_PATH | Windows: set it to leave your PATH alone |
Set them for the shell that runs the script:
curl -fsSL https://stirphp.github.io/core/install.sh | SPHP_VERSION=nightly shTo read the scripts first, they are install.sh and install.ps1.
Prebuilt binaries
To install by hand, every release has sphp for:
| Platform | Archive |
|---|---|
| Linux x86_64 | sphp-x86_64-unknown-linux-musl.tar.gz |
| Linux arm64 | sphp-aarch64-unknown-linux-musl.tar.gz |
| macOS Intel | sphp-x86_64-apple-darwin.tar.gz |
| macOS Apple silicon | sphp-aarch64-apple-darwin.tar.gz |
| Windows x86_64 | sphp-x86_64-pc-windows-msvc.zip |
| Windows arm64 | sphp-aarch64-pc-windows-msvc.zip |
Each also comes with the version in its name (sphp-0.1.1-x86_64-...). The Linux binaries are statically linked (musl), so they run on any distribution, whatever its glibc. releases/latest/download/<archive> always gets the newest release.
Each release also lists SHA256SUMS for the archives, and the VS Code extension as a .vsix (see Editor support).
Nightly builds
The nightly prerelease is rebuilt from every commit on main, with stable file names (sphp-nightly-<target>). The install script can fetch it:
curl -fsSL https://stirphp.github.io/core/install.sh | SPHP_VERSION=nightly shsphp --version tells which commit a nightly was built from. Nightlies may be broken; use them to try a fix before it is released.
From source
You need Rust (rustup; the repository pins the toolchain it needs) and Git:
git clone https://github.com/StirPHP/core stirphp
cd stirphp
git submodule update --init --depth 1 crates/stir_stubs/phpstorm-stubs
cargo install --path crates/stir_cliThe submodule holds JetBrains' phpstorm-stubs, the signatures of PHP's functions and classes, which are compiled into the binary. The repository's other submodules are test corpora you don't need.
To update, git pull, update the submodule the same way and run cargo install --path crates/stir_cli again.
Running the output
What StirPHP generates needs PHP 8.4 or later.
Editor support
sphp includes a language server. To set up VS Code, Neovim or Helix, see Editor support.
Next: Your first project.