This document covers changes between version 2 and version 3, and how you may update your code to adapt to them.
The internals of
Mezzio\Swoole\SwooleRequestHandlerRunner have changed entirely.
As a result, the constructor signature has also changed.
Before, it read:
public function __construct( Psr\Http\Server\RequestHandlerInterface $handler, callable $serverRequestFactory, callable $serverRequestErrorResponseGenerator, Mezzio\Swoole\PidManager $pidManager, Swoole\Http\Server $httpServer, Mezzio\Swoole\StaticResourceHandlerInterface $staticResourceHandler = null, Mezzio\Swoole\Log\AccessLogInterface $logger = null, string $processName = self::DEFAULT_PROCESS_NAME, ?Mezzio\Swoole\HotCodeReload\Reloader $hotCodeReloader = null )
It now reads:
public function __construct( Swoole\Http\Server $httpServer, Psr\EventDispatcher\EventDispatcherInterface $dispatcher )
As such, if you were providing your own factory for the class, or instantiating it manually, you will need to update your code. See the chapter on events for more information on how the the PSR-14 event dispatcher is used internally, and what listeners are provided.
Mezzio\Swoole\HotCodeReload\Reloader and its associated factory have been removed.
Use the HotCodeReloaderWorkerStartListener instead.
Additionally, with version 3, you will need to specify which paths you want to scan for changes via configuration. Please see the hot code reloading section on Configuration for details.
In version 2 of this package, if you wanted to use the Swoole HTTP Server task functionality, you needed to:
- Set the
task_worker_numoption for the server instance in configuration.
- Create and register a
taskevent handler with the server instance.
With version 3 of this package, we now always register a
task event handler (see the Swoole HTTP Server Events and Triggering Async Tasks chapters for details), which means you only need to configure the
Alternately, you can pass the
--num-task-workers|-t option with a numeric number of task workers to either of the
mezzio:swoole:reload console commands (see Command line usage section below for details).
Command line usage
In releases prior to version 3, the package shipped with its own binary,
mezzio-swoole, and defined the commands
Starting with version 3, the package now leverages laminas-cli, exposing the commands
As such, if you started the server as follows:
$ ./vendor/bin/mezzio-swoole start
you will now start it using:
$ ./vendor/bin/laminas mezzio:swoole:start
Usage of other commands will change similarly.
Found a mistake or want to contribute to the documentation? Edit this page on GitHub!