win32service/win32servicebundle
Symfony bundle for running and managing PHP applications as native Windows services using win32service. Provides service commands, configuration, and straightforward integration for Windows deployments.
Architecture fit. Win32ServiceBundle is a Symfony bundle that wraps the PECL win32service extension, letting a PHP CLI process register and run as a native Windows Service under the Service Control Manager (SCM). It is not a Laravel package: it ships a Symfony Bundle class, DI extension, and win32service:* console commands. In a Laravel codebase this is an adapter, not a dependency injection target — fit is contingent on consuming its service/command classes from a Laravel console command rather than registering the bundle in a Symfony kernel. Anything that assumes Symfony's kernel, event dispatcher, or bundle bootstrapping must be re-implemented or bypassed.
Integration feasibility. Feasible but non-trivial. Three workable paths, in ascending cost:
win32service extension directly in a Laravel command (bundle adds little).Path 1 or 3 is usually correct. Path 2 is the trap: partial bundle bootstrapping produces hard-to-diagnose lifecycle bugs.
Technical risk. High and concentrated in the platform, not the code:
win32service PECL extension, which must match PHP version, thread-safety (TS/NTS), architecture (x64/x86), and compiler (VC++ runtime). Extension availability typically lags new PHP minors — see key questions.queue:restart, --max-time); SCM expects a process that responds to stop control. Signal-based graceful shutdown semantics differ on Windows.Key questions.
win32service PECL extension publish binaries compatible with PHP 8.4/8.5 on our target Windows Server versions? "Added PHP 8.4 and 8.5 in test" likely means the bundle's test matrix, which may skip or mock the extension when it is unavailable — this release does not prove extension availability.Stack fit. Assume Laravel 10/11/12 on Windows Server 2019/2022, PHP 8.2–8.4 NTS x64. The bundle is compatible in principle (Symfony 7.4 support covers the components Laravel 11/12 use), but nothing in this release changes the fundamental mismatch: a Laravel app has no bundle registry. Plan for a thin host layer.
Migration path. Start with a spike, not a rollout:
php -m shows win32service and version alignment.app:worker) that runs one queue worker with a bounded --max-time.win32service:register command or sc create), configure recovery actions on failure, set the service account, and confirm start/stop/restart behave through services.msc, sc, and PowerShell Restart-Service.Compatibility. Pin the extension version alongside the PHP minor in host build images; treat PHP upgrades as a coupled change requiring an extension rebuild. Verify the bundle's Symfony constraint against the Laravel release in use before bumping either. PHP 8.5 is advertised as tested — do not adopt 8.5 in production until the extension publishes a matching build; this release is not evidence of that.
Sequencing. Extension + host image → single worker as a service → log/health plumbing → service account hardening → second worker (scheduler) → decommission any ad-hoc start /b or NSSM-based workarounds. Do not parallel-run both mechanisms on the same host.
Maintenance. Low code churn — this release is entirely CI hygiene plus a compatibility bump, which is a good signal about upstream stability. The real maintenance load is environmental: PHP minor upgrades, extension rebuilds, host image refreshes, and Windows patch cycles. Budget for a named owner of the Windows build image.
Support. First-line support must read the Windows Event Log and the application log, and know that a service showing "Running" in SCM says nothing about worker health. Build a health signal (heartbeat row, queue depth, last-processed timestamp) and alert on it — SCM will not restart a hung-but-alive process. Recovery-on-failure settings in SCM cover crashes only.
Scaling. Vertical and per-host. Each service instance is one OS process; scaling means more services or more hosts, both manual. No container orchestration, no rolling deploys — a deploy is stop, replace files, start, with an outage window per service unless you run blue/green as two service names behind a shared queue. Set explicit CPU/memory ceilings and --max-time recycling to contain the leaks inherent to long-lived PHP processes.
Failure modes. Extension missing or bitness/TS mismatch → service fails to start with a generic SCM error. Service account lacks rights → runtime failures on file/network/DB access that only appear under load or on first write. Stdout discarded → silent failures. Hung worker → SCM reports healthy while the queue backs up. Non-idempotent jobs → duplicate processing when SCM restarts after a partial run. Deploy while jobs are in flight → truncated work unless workers drain. Scheduler overlap → two instances of a cron task if registration is duplicated across hosts.
Ramp-up. Assume two to three days for an engineer unfamiliar with Windows services to reach a working single-worker spike, plus ongoing dependency on whoever holds Windows administration skills — a rare profile on typical Laravel teams. The bundle itself is small and learnable in an hour; the SCM, permissions, and packaging surface is where the time goes. If the team has no Windows operations capability, treat that gap as the primary risk, not the package.
How can I help you explore Laravel packages today?