Dockerfile and a box.json build manifest, is available in the suvera/winter-example-service repository.
Choose an Application Runner
Before building, choose the runner that matches your deployment target. Each runner starts the application in a different mode.WinterWebSwooleApplication
Recommended for production. Starts a Swoole HTTP server with multiple worker processes. Supports
#[Async], #[Scheduled], daemon threads, and the local KV/Queue stores. Requires the swoole PHP extension.WinterWebApplication
Traditional PHP-FPM / CGI runner. Each request is a new process invocation — no persistent workers. Use this when Swoole is unavailable or when integrating with an existing PHP-FPM pool.
WinterCliApplication
Command-line runner. Boots the application context and fires the
ApplicationReady event, then exits. Useful for batch jobs, migrations, and one-off administrative scripts.bin/app.php
Build Process
Use Box to compile your application and all its Composer dependencies into a single, self-contained Phar archive.1
Install dependencies
2
Install Box
3
Create box.json
Add a
box.json configuration file to your project root:box.json
4
Compile the Phar
Deployment
Docker Deployment
Winter Boot ships a baseDockerfile at build/docker/Dockerfile that extends the official php:8.5-cli image and pre-installs the extensions most modules require:
build/docker/Dockerfile
Dockerfile
Key Considerations
PHP 8.4+ required
PHP 8.4+ required
Winter Boot requires PHP 8.4 or higher. The base image ships PHP 8.5-cli.
Swoole extension
Swoole extension
Install via
pecl install swoole for the WinterWebSwooleApplication runner. The base image already includes it.Composer install at build time
Composer install at build time
Run
composer install --no-dev --optimize-autoloader during the docker build step, not at container start. Installing at start adds latency to every container launch.Config directory at runtime
Config directory at runtime
Mount your
application.yml at a known path and pass it with -c /config at container start. Avoid baking environment-specific config into the image layer.Kubernetes — Init Container for Migrations
When deploying with SQL migrations, run the migrator as a Kubernetes init container so the schema is up-to-date before any application pod starts:k8s/deployment.yaml
Bare-Metal / VM Deployment
For traditional host-based deployments, build a Phar archive and manage the process with the provided init.d sample script. Start the application with an explicit config directory:-c flag points to the directory containing your application.yml (and any additional config files such as logger.yml).
init.d Service Management
Winter Boot ships a ready-to-use init.d template atbuild/init.d.sample.sh. Copy it and register it with your init system:
/etc/init.d/my-winter-service
systemd Service Management
To use systemd instead, create a native unit file:/etc/systemd/system/my-winter-service.service
PHP-FPM Deployment
When usingWinterWebApplication (without Swoole), point your web server’s FastCGI configuration at your application entry point:
/etc/nginx/sites-available/my-app.conf
Full Example Project
Thesuvera/winter-example-service repository demonstrates a complete Winter Boot microservice with a production-ready setup:
Dockerfile
A production-ready multi-stage
Dockerfile built on the Winter Boot base image.box.json manifest
A
box.json build manifest for Phar packaging, suitable for CI/CD pipelines.Migration init container
SQL migration setup using the Kubernetes init container pattern.