Skip to main content
Winter Boot applications can be shipped in several ways depending on your infrastructure: as a self-contained Phar archive for bare-metal hosts, as a Docker image for containerised deployments, or via standard PHP-FPM for environments that already manage PHP processes. The framework ships with a sample init.d script and Docker base image to get you started quickly. A fully working example, including a 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
WinterWebApplication (PHP-FPM) does not support #[Async], #[Scheduled], daemon threads, or the local KV/Queue stores. These features require WinterWebSwooleApplication.

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

Verify the installation:
3

Create box.json

Add a box.json configuration file to your project root:
box.json
4

Compile the Phar

On success, the output file is a standalone executable:

Deployment

Docker Deployment

Winter Boot ships a base Dockerfile at build/docker/Dockerfile that extends the official php:8.5-cli image and pre-installs the extensions most modules require:
build/docker/Dockerfile
Build your application image on top of the base image:
Dockerfile

Key Considerations

Winter Boot requires PHP 8.4 or higher. The base image ships PHP 8.5-cli.
Install via pecl install swoole for the WinterWebSwooleApplication runner. The base image already includes it.
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.
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:
The -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 at build/init.d.sample.sh. Copy it and register it with your init system:
Edit the variables at the top of the file to match your environment:
/etc/init.d/my-winter-service
Then control the service with standard commands:

systemd Service Management

To use systemd instead, create a native unit file:
/etc/systemd/system/my-winter-service.service
Reload systemd and enable the service:

PHP-FPM Deployment

When using WinterWebApplication (without Swoole), point your web server’s FastCGI configuration at your application entry point:
/etc/nginx/sites-available/my-app.conf
WinterWebApplication (PHP-FPM) does not support #[Async], #[Scheduled], daemon threads, or the local KV/Queue stores. Switch to WinterWebSwooleApplication if you need any of these features.

Full Example Project

The suvera/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.