- What is crazywhalecc/static-php-cli?
- It is a PHP-based build orchestrator that compiles fully statically linked PHP binaries for the CLI, FPM, embed, and micro SAPIs, bundling a curated set of extensions. It is infrastructure tooling rather than a runtime library, so you use it in CI or Docker to produce portable PHP executables. Those binaries can run on machines with no system PHP or shared libraries installed.
- Can I install static-php-cli with composer require inside a Laravel app?
- You can install it globally or as a phar, but it should not be added as an application dependency in a Laravel project's composer.json. It has no service provider, config publishing, or migrations, and it does not participate in the web request path. Treat it as a build tool that runs in CI or a dedicated build container.
- Does static-php-cli support Laravel 10, 11, and 12?
- It currently compiles PHP versions in the 8.0 through 8.5 range, which covers the PHP requirements for Laravel 10, 11, and 12. Laravel 10 requires PHP 8.1 or newer, Laravel 11 requires 8.2 or newer, and Laravel 12 follows the same 8.2 baseline. Always confirm the exact PHP minor you target is available in the spc release you pin.
- How do I build a single binary for a Laravel artisan console command?
- Use the micro SAPI together with micro.sfx to bundle your application source and a pinned extension set into one executable. Configure the PHP version, SAPI, and extensions in spc's YAML or JSON build config, then run the build in Docker or CI. Start with a stable base CLI build before attempting micro.sfx bundling, because debugging bundled binaries is harder.
- Which PHP extensions do I need for a typical Laravel application?
- At minimum you need mbstring, openssl, tokenizer, ctype, json, fileinfo, bcmath, curl, and the pdo driver matching your database such as pdo_mysql or pdo_sqlite. Add intl, redis, and any other extension your composer.json platform requirements or packages demand. Validate the extension matrix against Laravel's own requirements and your actual dependency tree rather than guessing.
- Is static-php-cli related to FrankenPHP and Laravel Octane?
- Yes, FrankenPHP is built using static-php-cli, and Laravel Octane supports FrankenPHP as an application server. If your team already runs Octane with FrankenPHP, spc is effectively already in your transitive dependency graph. In that case, evaluate and version FrankenPHP directly rather than adopting spc as a separate workstream.
- Can I ship Laravel queue workers as static PHP binaries?
- Yes, queue workers are long-running CLI processes, which is a strong fit for a self-contained binary alongside console commands and internal tooling. You avoid installing PHP and extensions on worker hosts, which helps in air-gapped or appliance-style deployments. The tradeoff is that security patches require rebuilding and redistributing the binary instead of patching a base image.
- Does static-php-cli support Windows builds?
- Linux on x86_64 and aarch64, including both glibc and musl targets, is the first-class platform, and macOS is supported. Windows builds are handled through Cygwin or WSL rather than natively, so expect extra setup friction. Test in the target environment because musl and glibc differ in DNS resolution and locale behavior.
- How long do static PHP builds take and are they reproducible?
- Expect builds to take tens of minutes per target and to be CPU-heavy, so run them in a dedicated Docker build image in CI. Recent v2.x releases add lockfile support that markedly improves determinism across rebuilds. Pin the spc version and the lockfile so the same inputs produce the same artifact.
- What are the security and maintenance tradeoffs of static PHP binaries?
- Static linking removes the option of patching libssl or other libraries in a base image, so every CVE requires a rebuild-and-redistribute cycle. Sources and patches come from php.net, GitHub, and mirrors with checksums enforced, but that pipeline becomes a trust boundary your SBOM process must absorb. Also expect support for new PHP minors to lag by weeks, with extension coverage such as swoole, imagick, and grpc trailing further.