Download the PHP package luzrain/workerman-bundle without Composer
On this page you can find all versions of the php package luzrain/workerman-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download luzrain/workerman-bundle
More information about luzrain/workerman-bundle
Files in luzrain/workerman-bundle
Package workerman-bundle
Short Description Workerman runtime for symfony applications
License MIT
Homepage https://github.com/luzrain/workerman-bundle
Informations about the package workerman-bundle
Workerman runtime for symfony applications
Workerman is a high-performance, asynchronous event-driven PHP framework written in pure PHP.
This bundle provides a Workerman integration in Symfony, allowing you to easily create a http server, scheduler and supervisor all in one place.
This bundle allows you to replace a traditional web application stack like php-fpm + nginx + cron + supervisord, all written in pure PHP (no Go, no external binaries).
The request handler works in an event loop which means the Symfony kernel and the dependency injection container are preserved between requests,
making your application faster with less (or no) code changes.
Getting started
Install composer packages
Enable the bundle
Configure the bundle
A minimal configuration might look like this.
For all available options with documentation, see the command output.
Start application
* For better performance, Workerman recommends installing the php-event extension.
Reload strategies
Because of the asynchronous nature of the server, the workers reuse loaded resources on each request. This means that in some cases we need to restart workers.
For example, after an exception is thrown, to prevent services from being in an unrecoverable state. Or every time you change the code in the IDE.
There are a few restart strategies that are implemented and can be enabled or disabled depending on the environment.
- exception
Reload worker each time that an exception is thrown during the request handling. - max_requests
Reload worker on every N request to prevent memory leaks. - file_monitor
Reload all workers each time you change the files**. - always
Reload worker after each request.
** It is highly recommended to install the php-inotify extension for file monitoring. Without it, monitoring will work in polling mode, which can be very cpu and disk intensive for large projects.
See all available options for each strategy in the command output.
Implement your own reload strategies
You can create reload strategy with your own logic by implementing the RebootStrategyInterface and adding the workerman.reboot_strategy
tag to the service.
Scheduler
Periodic tasks can be configured with attributes or with tags in configuration files.
Schedule string can be formatted in several ways:
- An integer to define the frequency as a number of seconds. Example: 60
- An ISO8601 datetime format. Example: 2023-08-01T01:00:00+08:00
- An ISO8601 duration format. Example: PT1M
- A relative date format as supported by DateInterval. Example: 1 minutes
- A cron expression*. Example: _/1 _
** Note that you need to install the dragonmantank/cron-expression package if you want to use cron expressions as schedule strings
Supervisor
Supervisor can be configured with attributes or with tags in configuration files.
Processes are kept alive and wake up if one of them dies.
All versions of workerman-bundle with dependencies
ext-pcntl Version *
ext-posix Version *
league/mime-type-detection Version ^1.13
psr/http-factory Version ^1.0
psr/http-message Version ^2.0
psr/log Version ^3.0
symfony/config Version ^6.4|^7.0
symfony/console Version ^6.4|^7.0
symfony/dependency-injection Version ^6.4|^7.0
symfony/http-kernel Version ^6.4|^7.0
symfony/psr-http-message-bridge Version ^6.4|^7.0
symfony/runtime Version ^6.4|^7.0
workerman/workerman Version ^4.1