From 4b45f159b116c6386d3e37a9492a1f617d40f6c2 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 22 Mar 2024 23:49:40 +0800 Subject: [PATCH] Rename --- README.md | 34 +++++++++---------- composer.json | 14 ++++---- phpunit.xml | 4 +-- src/ConfigLoader.php | 6 ++-- src/Event/HttpServerStartEvent.php | 4 +-- src/FileMonitorWatcher/FileMonitorWatcher.php | 2 +- .../InotifyMonitorWatcher.php | 2 +- .../PollingMonitorWatcher.php | 2 +- src/Http/HttpRequestHandler.php | 4 +-- src/Http/MimeTypeMapper.php | 2 +- src/Http/Psr17Factory.php | 8 ++--- src/Internal/Functions.php | 2 +- src/Internal/WorkerConfigurator.php | 6 ++-- src/KernelFactory.php | 2 +- ...erBundle.php => PHPStreamServerBundle.php} | 6 ++-- src/ReloadStrategy/OnEachRequest.php | 6 ++-- src/ReloadStrategy/OnException.php | 8 ++--- src/ReloadStrategy/OnMemoryLimit.php | 6 ++-- src/ReloadStrategy/OnRequestsLimit.php | 6 ++-- src/ReloadStrategy/OnTTLLimit.php | 6 ++-- src/Runner.php | 28 +++++++-------- src/Runtime.php | 2 +- .../Trigger/CronExpressionTrigger.php | 2 +- src/Scheduler/Trigger/DateTimeTrigger.php | 2 +- src/Scheduler/Trigger/JitterTrigger.php | 2 +- src/Scheduler/Trigger/PeriodicalTrigger.php | 2 +- src/Scheduler/Trigger/TriggerFactory.php | 2 +- src/Scheduler/Trigger/TriggerInterface.php | 2 +- src/Worker/FileMonitorWorker.php | 6 ++-- src/Worker/HttpServerWorker.php | 16 ++++----- src/Worker/ProcessWorker.php | 6 ++-- src/Worker/SchedulerWorker.php | 10 +++--- src/config/configuration.php | 2 +- src/config/services.php | 18 +++++----- tests/App/Kernel.php | 8 ++--- tests/App/RequestTestController.php | 2 +- tests/App/TestProcess.php | 2 +- tests/App/TestTask.php | 2 +- tests/App/index.php | 2 +- tests/ProcessTest.php | 2 +- tests/RequestTest.php | 2 +- tests/ServicesAutowiringTest.php | 6 ++-- tests/TaskTest.php | 2 +- 43 files changed, 129 insertions(+), 129 deletions(-) rename src/{PhpRunnerBundle.php => PHPStreamServerBundle.php} (82%) diff --git a/README.md b/README.md index f0400a2..4aedd5f 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -# PhpRunner runtime for symfony applications +# PHPStreamServer runtime for symfony applications ![PHP >=8.2](https://img.shields.io/badge/PHP->=8.2-777bb3.svg?style=flat) ![Symfony ^7.0](https://img.shields.io/badge/Symfony-^7.0-374151.svg?style=flat) -[![Version](https://img.shields.io/github/v/tag/luzrain/phprunner-bundle?label=Version&filter=v*.*.*&sort=semver&color=374151)](../../releases) -[![Tests Status](https://img.shields.io/github/actions/workflow/status/luzrain/phprunner-bundle/tests.yaml?label=Tests&branch=master)](../../actions/workflows/tests.yaml) +[![Version](https://img.shields.io/github/v/tag/luzrain/phpstreamserver-bundle?label=Version&filter=v*.*.*&sort=semver&color=374151)](../../releases) +[![Tests Status](https://img.shields.io/github/actions/workflow/status/luzrain/phpstreamserver-bundle/tests.yaml?label=Tests&branch=master)](../../actions/workflows/tests.yaml) -This bundle provides a [PhpRunner](https://github.com/luzrain/phprunner) integration with Symfony framework to run your application in a highly efficient event-loop based runtime. +This bundle provides a [PHPStreamServer](https://github.com/luzrain/phpstreamserver) integration with Symfony framework to run your application in a highly efficient event-loop based runtime. ## Getting started ### Install composer packages ```bash -$ composer require luzrain/phprunner-bundle +$ composer require luzrain/phpstreamserver-bundle ``` ### Enable the bundle @@ -19,7 +19,7 @@ $ composer require luzrain/phprunner-bundle return [ // ... - Luzrain\PhpRunnerBundle\PhpRunnerBundle::class => ['all' => true], + Luzrain\PHPStreamServerBundle\PHPStreamServerBundle::class => ['all' => true], ]; ``` @@ -27,13 +27,13 @@ return [ A minimal configuration might look like this. For all available options with documentation, see the command output. ```bash -$ bin/console config:dump-reference phprunner +$ bin/console config:dump-reference phpstreamserver ``` ```yaml -# config/packages/phprunner.yaml +# config/packages/phpstreamserver.yaml -phprunner: +phpstreamserver: servers: - name: 'Webserver' listen: http://0.0.0.0:80 @@ -42,7 +42,7 @@ phprunner: ### Start application ```bash -$ APP_RUNTIME=Luzrain\\PhpRunnerBundle\\Runtime php public/index.php start +$ APP_RUNTIME=Luzrain\\PHPStreamServerBundle\\Runtime php public/index.php start ``` \* For better performance, install the _php-uv_ extension. @@ -71,13 +71,13 @@ The bundle provides several restart strategies that can be configured depending See all available options for each strategy in the command output. ```bash -$ bin/console config:dump-reference phprunner reload_strategy +$ bin/console config:dump-reference phpstreamserver reload_strategy ``` ```yaml -# config/packages/phprunner.yaml +# config/packages/phpstreamserver.yaml -phprunner: +phpstreamserver: reload_strategy: on_exception: active: true @@ -99,9 +99,9 @@ Schedule string can be formatted in several ways: ** Note that you need to install the [dragonmantank/cron-expression](https://github.com/dragonmantank/cron-expression) package if you want to use cron expressions as schedule strings ```yaml -# config/packages/phprunner.yaml +# config/packages/phpstreamserver.yaml -phprunner: +phpstreamserver: tasks: # Runs external program every 15 seconds - name: 'Task 1' @@ -120,9 +120,9 @@ It can also work with both external commands and internal Symfony commands. To run a Symfony command, simply type the command name without any prefixes. ```yaml -# config/packages/phprunner.yaml +# config/packages/phpstreamserver.yaml -phprunner: +phpstreamserver: processes: # Runs external program - name: 'External process' diff --git a/composer.json b/composer.json index 6fa92ef..68279da 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { - "name": "luzrain/phprunner-bundle", - "description": "Phprunner runtime for symfony applications", - "keywords": ["phprunner", "symfony", "runtime", "php-runtime"], - "homepage": "https://github.com/luzrain/phprunner-bundle", + "name": "luzrain/phpstreamserver-bundle", + "description": "PHPStreamServer runtime for symfony applications", + "keywords": ["phpstreamserver", "symfony", "runtime", "php-runtime"], + "homepage": "https://github.com/luzrain/phpstreamserver-bundle", "type": "symfony-bundle", "license": "MIT", "authors": [ @@ -15,7 +15,7 @@ "php": ">=8.2", "ext-pcntl": "*", "ext-posix": "*", - "luzrain/phprunner": "^0.1", + "luzrain/phpstreamserver": "^0.2.0", "psr/http-factory": "^1.0", "symfony/config": "^7.0", "symfony/dependency-injection": "^7.0", @@ -37,12 +37,12 @@ }, "autoload": { "psr-4": { - "Luzrain\\PhpRunnerBundle\\": "src/" + "Luzrain\\PHPStreamServerBundle\\": "src/" } }, "autoload-dev": { "psr-4": { - "Luzrain\\PhpRunnerBundle\\Test\\": "tests/" + "Luzrain\\PHPStreamServerBundle\\Test\\": "tests/" } }, "scripts": { diff --git a/phpunit.xml b/phpunit.xml index 913cbff..e330fd4 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -17,8 +17,8 @@ - - + + diff --git a/src/ConfigLoader.php b/src/ConfigLoader.php index f559e30..e677572 100644 --- a/src/ConfigLoader.php +++ b/src/ConfigLoader.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle; +namespace Luzrain\PHPStreamServerBundle; use Symfony\Component\Config\ConfigCache; use Symfony\Component\Config\Resource\DirectoryResource; @@ -15,7 +15,7 @@ final class ConfigLoader implements CacheWarmerInterface public function __construct(private string $projectDir, string $cacheDir, bool $isDebug) { - $this->cache = new ConfigCache(\sprintf('%s/phprunner_config.cache.php', $cacheDir), $isDebug); + $this->cache = new ConfigCache(\sprintf('%s/phpss_config.cache.php', $cacheDir), $isDebug); } public function isOptional(): bool @@ -26,7 +26,7 @@ public function isOptional(): bool public function warmUp(string $cacheDir, string $buildDir = null): array { $packagesDir = \sprintf('%s/config/packages', $this->projectDir); - $metadata = \is_dir($packagesDir) ? [new DirectoryResource($packagesDir, '/phprunner/')] : []; + $metadata = \is_dir($packagesDir) ? [new DirectoryResource($packagesDir, '/phpstreamserver/')] : []; $this->cache->write(\sprintf('config, true)), $metadata); return []; diff --git a/src/Event/HttpServerStartEvent.php b/src/Event/HttpServerStartEvent.php index 0e3fc8d..04c2a12 100644 --- a/src/Event/HttpServerStartEvent.php +++ b/src/Event/HttpServerStartEvent.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Event; +namespace Luzrain\PHPStreamServerBundle\Event; -use Luzrain\PhpRunner\WorkerProcess; +use Luzrain\PHPStreamServer\WorkerProcess; use Symfony\Contracts\EventDispatcher\Event; final class HttpServerStartEvent extends Event diff --git a/src/FileMonitorWatcher/FileMonitorWatcher.php b/src/FileMonitorWatcher/FileMonitorWatcher.php index a1669d7..47ecddc 100644 --- a/src/FileMonitorWatcher/FileMonitorWatcher.php +++ b/src/FileMonitorWatcher/FileMonitorWatcher.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\FileMonitorWatcher; +namespace Luzrain\PHPStreamServerBundle\FileMonitorWatcher; use Psr\Log\LoggerInterface; use Revolt\EventLoop\Driver; diff --git a/src/FileMonitorWatcher/InotifyMonitorWatcher.php b/src/FileMonitorWatcher/InotifyMonitorWatcher.php index 8b129e8..6c88cd9 100644 --- a/src/FileMonitorWatcher/InotifyMonitorWatcher.php +++ b/src/FileMonitorWatcher/InotifyMonitorWatcher.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\FileMonitorWatcher; +namespace Luzrain\PHPStreamServerBundle\FileMonitorWatcher; use Revolt\EventLoop\Driver; diff --git a/src/FileMonitorWatcher/PollingMonitorWatcher.php b/src/FileMonitorWatcher/PollingMonitorWatcher.php index c1820d4..e3ff72d 100644 --- a/src/FileMonitorWatcher/PollingMonitorWatcher.php +++ b/src/FileMonitorWatcher/PollingMonitorWatcher.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\FileMonitorWatcher; +namespace Luzrain\PHPStreamServerBundle\FileMonitorWatcher; use Revolt\EventLoop\Driver; diff --git a/src/Http/HttpRequestHandler.php b/src/Http/HttpRequestHandler.php index 7f2eba4..4e2f626 100644 --- a/src/Http/HttpRequestHandler.php +++ b/src/Http/HttpRequestHandler.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Http; +namespace Luzrain\PHPStreamServerBundle\Http; -use Luzrain\PhpRunner\WorkerProcess; +use Luzrain\PHPStreamServer\WorkerProcess; use Psr\Http\Message\ResponseFactoryInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; diff --git a/src/Http/MimeTypeMapper.php b/src/Http/MimeTypeMapper.php index f5849fb..d6366da 100644 --- a/src/Http/MimeTypeMapper.php +++ b/src/Http/MimeTypeMapper.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Http; +namespace Luzrain\PHPStreamServerBundle\Http; final class MimeTypeMapper { diff --git a/src/Http/Psr17Factory.php b/src/Http/Psr17Factory.php index 90fe6ab..9f0acb9 100644 --- a/src/Http/Psr17Factory.php +++ b/src/Http/Psr17Factory.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Http; +namespace Luzrain\PHPStreamServerBundle\Http; -use Luzrain\PhpRunner\Server\Http\Psr7\ResourceStream; -use Luzrain\PhpRunner\Server\Http\Psr7\Response; -use Luzrain\PhpRunner\Server\Http\Psr7\StringStream; +use Luzrain\PHPStreamServer\Server\Http\Psr7\ResourceStream; +use Luzrain\PHPStreamServer\Server\Http\Psr7\Response; +use Luzrain\PHPStreamServer\Server\Http\Psr7\StringStream; use Psr\Http\Message\ResponseFactoryInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestFactoryInterface; diff --git a/src/Internal/Functions.php b/src/Internal/Functions.php index fbd6c38..3a6743c 100644 --- a/src/Internal/Functions.php +++ b/src/Internal/Functions.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Internal; +namespace Luzrain\PHPStreamServerBundle\Internal; /** * @internal diff --git a/src/Internal/WorkerConfigurator.php b/src/Internal/WorkerConfigurator.php index 20a0fa6..15ae1d8 100644 --- a/src/Internal/WorkerConfigurator.php +++ b/src/Internal/WorkerConfigurator.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Internal; +namespace Luzrain\PHPStreamServerBundle\Internal; -use Luzrain\PhpRunner\WorkerProcess; +use Luzrain\PHPStreamServer\WorkerProcess; use Psr\Log\LoggerInterface; use Symfony\Component\ErrorHandler\ErrorHandler; use Symfony\Component\HttpKernel\KernelInterface; @@ -22,7 +22,7 @@ public function configure(WorkerProcess $worker): void * @psalm-suppress UndefinedInterfaceMethod */ if ($this->logger instanceof \Monolog\Logger) { - $this->logger = $this->logger->withName('phprunner'); + $this->logger = $this->logger->withName('phpstreamserver'); } $errorHandler = ErrorHandler::register(null, false); diff --git a/src/KernelFactory.php b/src/KernelFactory.php index e8d20c9..0f211e4 100644 --- a/src/KernelFactory.php +++ b/src/KernelFactory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle; +namespace Luzrain\PHPStreamServerBundle; use Symfony\Component\HttpKernel\KernelInterface; diff --git a/src/PhpRunnerBundle.php b/src/PHPStreamServerBundle.php similarity index 82% rename from src/PhpRunnerBundle.php rename to src/PHPStreamServerBundle.php index 332fd08..eff1a48 100644 --- a/src/PhpRunnerBundle.php +++ b/src/PHPStreamServerBundle.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle; +namespace Luzrain\PHPStreamServerBundle; use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\HttpKernel\Bundle\AbstractBundle; -final class PhpRunnerBundle extends AbstractBundle +final class PHPStreamServerBundle extends AbstractBundle { - protected string $extensionAlias = 'phprunner'; + protected string $extensionAlias = 'phpstreamserver'; public function configure(DefinitionConfigurator $definition): void { diff --git a/src/ReloadStrategy/OnEachRequest.php b/src/ReloadStrategy/OnEachRequest.php index 5e4c616..688df84 100644 --- a/src/ReloadStrategy/OnEachRequest.php +++ b/src/ReloadStrategy/OnEachRequest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\ReloadStrategy; +namespace Luzrain\PHPStreamServerBundle\ReloadStrategy; -use Luzrain\PhpRunner\ReloadStrategy\EachRequestReloadStrategy; -use Luzrain\PhpRunnerBundle\Event\HttpServerStartEvent; +use Luzrain\PHPStreamServer\ReloadStrategy\EachRequestReloadStrategy; +use Luzrain\PHPStreamServerBundle\Event\HttpServerStartEvent; final class OnEachRequest extends EachRequestReloadStrategy { diff --git a/src/ReloadStrategy/OnException.php b/src/ReloadStrategy/OnException.php index 323ac51..0799aad 100644 --- a/src/ReloadStrategy/OnException.php +++ b/src/ReloadStrategy/OnException.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\ReloadStrategy; +namespace Luzrain\PHPStreamServerBundle\ReloadStrategy; -use Luzrain\PhpRunner\Exception\HttpException; -use Luzrain\PhpRunner\ReloadStrategy\ReloadStrategyInterface; -use Luzrain\PhpRunnerBundle\Event\HttpServerStartEvent; +use Luzrain\PHPStreamServer\Exception\HttpException; +use Luzrain\PHPStreamServer\ReloadStrategy\ReloadStrategyInterface; +use Luzrain\PHPStreamServerBundle\Event\HttpServerStartEvent; use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\HttpKernelInterface; diff --git a/src/ReloadStrategy/OnMemoryLimit.php b/src/ReloadStrategy/OnMemoryLimit.php index 965d2d4..480b5e8 100644 --- a/src/ReloadStrategy/OnMemoryLimit.php +++ b/src/ReloadStrategy/OnMemoryLimit.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\ReloadStrategy; +namespace Luzrain\PHPStreamServerBundle\ReloadStrategy; -use Luzrain\PhpRunner\ReloadStrategy\MaxMemoryReloadStrategy; -use Luzrain\PhpRunnerBundle\Event\HttpServerStartEvent; +use Luzrain\PHPStreamServer\ReloadStrategy\MaxMemoryReloadStrategy; +use Luzrain\PHPStreamServerBundle\Event\HttpServerStartEvent; final class OnMemoryLimit extends MaxMemoryReloadStrategy { diff --git a/src/ReloadStrategy/OnRequestsLimit.php b/src/ReloadStrategy/OnRequestsLimit.php index 031a1d8..2416d83 100644 --- a/src/ReloadStrategy/OnRequestsLimit.php +++ b/src/ReloadStrategy/OnRequestsLimit.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\ReloadStrategy; +namespace Luzrain\PHPStreamServerBundle\ReloadStrategy; -use Luzrain\PhpRunner\ReloadStrategy\MaxRequestsReloadStrategy; -use Luzrain\PhpRunnerBundle\Event\HttpServerStartEvent; +use Luzrain\PHPStreamServer\ReloadStrategy\MaxRequestsReloadStrategy; +use Luzrain\PHPStreamServerBundle\Event\HttpServerStartEvent; final class OnRequestsLimit extends MaxRequestsReloadStrategy { diff --git a/src/ReloadStrategy/OnTTLLimit.php b/src/ReloadStrategy/OnTTLLimit.php index 3a44e0e..538f5e8 100644 --- a/src/ReloadStrategy/OnTTLLimit.php +++ b/src/ReloadStrategy/OnTTLLimit.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\ReloadStrategy; +namespace Luzrain\PHPStreamServerBundle\ReloadStrategy; -use Luzrain\PhpRunner\ReloadStrategy\TTLReloadStrategy; -use Luzrain\PhpRunnerBundle\Event\HttpServerStartEvent; +use Luzrain\PHPStreamServer\ReloadStrategy\TTLReloadStrategy; +use Luzrain\PHPStreamServerBundle\Event\HttpServerStartEvent; final class OnTTLLimit extends TTLReloadStrategy { diff --git a/src/Runner.php b/src/Runner.php index e1832b7..2c921ef 100644 --- a/src/Runner.php +++ b/src/Runner.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle; +namespace Luzrain\PHPStreamServerBundle; -use Luzrain\PhpRunner\PhpRunner; -use Luzrain\PhpRunnerBundle\Internal\Functions; -use Luzrain\PhpRunnerBundle\Worker\FileMonitorWorker; -use Luzrain\PhpRunnerBundle\Worker\HttpServerWorker; -use Luzrain\PhpRunnerBundle\Worker\ProcessWorker; -use Luzrain\PhpRunnerBundle\Worker\SchedulerWorker; +use Luzrain\PHPStreamServer\Server; +use Luzrain\PHPStreamServerBundle\Internal\Functions; +use Luzrain\PHPStreamServerBundle\Worker\FileMonitorWorker; +use Luzrain\PHPStreamServerBundle\Worker\HttpServerWorker; +use Luzrain\PHPStreamServerBundle\Worker\ProcessWorker; +use Luzrain\PHPStreamServerBundle\Worker\SchedulerWorker; use Symfony\Component\Runtime\RunnerInterface; final readonly class Runner implements RunnerInterface @@ -28,13 +28,13 @@ public function run(): int $config = $configLoader->getConfig($this->kernelFactory); - $phpRunner = new PhpRunner( + $server = new Server( pidFile: $config['pid_file'], stopTimeout: $config['stop_timeout'], ); foreach ($config['servers'] as $serverConfig) { - $phpRunner->addWorkers(new HttpServerWorker( + $server->addWorkers(new HttpServerWorker( kernelFactory: $this->kernelFactory, listen: $serverConfig['listen'], localCert: $serverConfig['local_cert'], @@ -48,7 +48,7 @@ public function run(): int } if (!empty($config['tasks'])) { - $phpRunner->addWorkers(new SchedulerWorker( + $server->addWorkers(new SchedulerWorker( kernelFactory: $this->kernelFactory, user: $config['user'], group: $config['group'], @@ -57,7 +57,7 @@ public function run(): int } foreach ($config['processes'] as $processConfig) { - $phpRunner->addWorkers(new ProcessWorker( + $server->addWorkers(new ProcessWorker( kernelFactory: $this->kernelFactory, user: $config['user'], group: $config['group'], @@ -68,16 +68,16 @@ public function run(): int } if ($config['reload_strategy']['on_file_change']['active']) { - $phpRunner->addWorkers(new FileMonitorWorker( + $server->addWorkers(new FileMonitorWorker( sourceDir: $config['reload_strategy']['on_file_change']['source_dir'], filePattern: $config['reload_strategy']['on_file_change']['file_pattern'], pollingInterval: $config['reload_strategy']['on_file_change']['polling_interval'], user: $config['user'], group: $config['group'], - reloadCallback: $phpRunner->reload(...), + reloadCallback: $server->reload(...), )); } - return $phpRunner->run(); + return $server->run(); } } diff --git a/src/Runtime.php b/src/Runtime.php index d60e066..5a07140 100644 --- a/src/Runtime.php +++ b/src/Runtime.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle; +namespace Luzrain\PHPStreamServerBundle; use Symfony\Component\Runtime\ResolverInterface; use Symfony\Component\Runtime\RunnerInterface; diff --git a/src/Scheduler/Trigger/CronExpressionTrigger.php b/src/Scheduler/Trigger/CronExpressionTrigger.php index 717888e..51390af 100644 --- a/src/Scheduler/Trigger/CronExpressionTrigger.php +++ b/src/Scheduler/Trigger/CronExpressionTrigger.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Scheduler\Trigger; +namespace Luzrain\PHPStreamServerBundle\Scheduler\Trigger; use Cron\CronExpression; diff --git a/src/Scheduler/Trigger/DateTimeTrigger.php b/src/Scheduler/Trigger/DateTimeTrigger.php index 41a9db2..f764c2d 100644 --- a/src/Scheduler/Trigger/DateTimeTrigger.php +++ b/src/Scheduler/Trigger/DateTimeTrigger.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Scheduler\Trigger; +namespace Luzrain\PHPStreamServerBundle\Scheduler\Trigger; final class DateTimeTrigger implements TriggerInterface { diff --git a/src/Scheduler/Trigger/JitterTrigger.php b/src/Scheduler/Trigger/JitterTrigger.php index 64cc95c..36f8216 100644 --- a/src/Scheduler/Trigger/JitterTrigger.php +++ b/src/Scheduler/Trigger/JitterTrigger.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Scheduler\Trigger; +namespace Luzrain\PHPStreamServerBundle\Scheduler\Trigger; final class JitterTrigger implements TriggerInterface { diff --git a/src/Scheduler/Trigger/PeriodicalTrigger.php b/src/Scheduler/Trigger/PeriodicalTrigger.php index 43ce067..8c6a6c6 100644 --- a/src/Scheduler/Trigger/PeriodicalTrigger.php +++ b/src/Scheduler/Trigger/PeriodicalTrigger.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Scheduler\Trigger; +namespace Luzrain\PHPStreamServerBundle\Scheduler\Trigger; final class PeriodicalTrigger implements TriggerInterface { diff --git a/src/Scheduler/Trigger/TriggerFactory.php b/src/Scheduler/Trigger/TriggerFactory.php index 6e215e8..8b0643f 100644 --- a/src/Scheduler/Trigger/TriggerFactory.php +++ b/src/Scheduler/Trigger/TriggerFactory.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Scheduler\Trigger; +namespace Luzrain\PHPStreamServerBundle\Scheduler\Trigger; final class TriggerFactory { diff --git a/src/Scheduler/Trigger/TriggerInterface.php b/src/Scheduler/Trigger/TriggerInterface.php index adb6213..ad0529e 100644 --- a/src/Scheduler/Trigger/TriggerInterface.php +++ b/src/Scheduler/Trigger/TriggerInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Scheduler\Trigger; +namespace Luzrain\PHPStreamServerBundle\Scheduler\Trigger; interface TriggerInterface extends \Stringable { diff --git a/src/Worker/FileMonitorWorker.php b/src/Worker/FileMonitorWorker.php index cd1ada3..3035037 100644 --- a/src/Worker/FileMonitorWorker.php +++ b/src/Worker/FileMonitorWorker.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Worker; +namespace Luzrain\PHPStreamServerBundle\Worker; -use Luzrain\PhpRunner\WorkerProcess; -use Luzrain\PhpRunnerBundle\FileMonitorWatcher\FileMonitorWatcher; +use Luzrain\PHPStreamServer\WorkerProcess; +use Luzrain\PHPStreamServerBundle\FileMonitorWatcher\FileMonitorWatcher; final class FileMonitorWorker extends WorkerProcess { diff --git a/src/Worker/HttpServerWorker.php b/src/Worker/HttpServerWorker.php index 29d715c..3b236aa 100644 --- a/src/Worker/HttpServerWorker.php +++ b/src/Worker/HttpServerWorker.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Worker; +namespace Luzrain\PHPStreamServerBundle\Worker; -use Luzrain\PhpRunner\Server\Connection\ConnectionInterface; -use Luzrain\PhpRunner\Server\Protocols\Http; -use Luzrain\PhpRunner\Server\Server; -use Luzrain\PhpRunner\WorkerProcess; -use Luzrain\PhpRunnerBundle\Event\HttpServerStartEvent; -use Luzrain\PhpRunnerBundle\KernelFactory; +use Luzrain\PHPStreamServer\Listener; +use Luzrain\PHPStreamServer\Server\Connection\ConnectionInterface; +use Luzrain\PHPStreamServer\Server\Protocols\Http; +use Luzrain\PHPStreamServer\WorkerProcess; +use Luzrain\PHPStreamServerBundle\Event\HttpServerStartEvent; +use Luzrain\PHPStreamServerBundle\KernelFactory; use Psr\Http\Message\ServerRequestInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; @@ -57,7 +57,7 @@ private function onStart(): void /** @var EventDispatcherInterface $eventDispatcher */ $eventDispatcher = $kernel->getContainer()->get('event_dispatcher'); - $this->startServer(new Server( + $this->startListener(new Listener( listen: $this->listen, protocol: new Http( maxBodySize: $this->maxBodySize, diff --git a/src/Worker/ProcessWorker.php b/src/Worker/ProcessWorker.php index e09a67f..42a721d 100644 --- a/src/Worker/ProcessWorker.php +++ b/src/Worker/ProcessWorker.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Worker; +namespace Luzrain\PHPStreamServerBundle\Worker; -use Luzrain\PhpRunner\WorkerProcess; -use Luzrain\PhpRunnerBundle\KernelFactory; +use Luzrain\PHPStreamServer\WorkerProcess; +use Luzrain\PHPStreamServerBundle\KernelFactory; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\NullOutput; diff --git a/src/Worker/SchedulerWorker.php b/src/Worker/SchedulerWorker.php index 0a15a64..c5ece0b 100644 --- a/src/Worker/SchedulerWorker.php +++ b/src/Worker/SchedulerWorker.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Worker; +namespace Luzrain\PHPStreamServerBundle\Worker; -use Luzrain\PhpRunner\WorkerProcess; -use Luzrain\PhpRunnerBundle\KernelFactory; -use Luzrain\PhpRunnerBundle\Scheduler\Trigger\TriggerFactory; -use Luzrain\PhpRunnerBundle\Scheduler\Trigger\TriggerInterface; +use Luzrain\PHPStreamServer\WorkerProcess; +use Luzrain\PHPStreamServerBundle\KernelFactory; +use Luzrain\PHPStreamServerBundle\Scheduler\Trigger\TriggerFactory; +use Luzrain\PHPStreamServerBundle\Scheduler\Trigger\TriggerInterface; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\NullOutput; diff --git a/src/config/configuration.php b/src/config/configuration.php index f940881..dba1a5a 100644 --- a/src/config/configuration.php +++ b/src/config/configuration.php @@ -24,7 +24,7 @@ ->scalarNode('pid_file') ->info('File to store master process PID') ->cannotBeEmpty() - ->defaultValue('%kernel.project_dir%/var/run/phprunner.pid') + ->defaultValue('%kernel.project_dir%/var/run/phpss.pid') ->end() ->arrayNode('servers') ->prototype('array') diff --git a/src/config/services.php b/src/config/services.php index 72acd30..47d95dd 100644 --- a/src/config/services.php +++ b/src/config/services.php @@ -2,15 +2,15 @@ declare(strict_types=1); -use Luzrain\PhpRunnerBundle\ConfigLoader; -use Luzrain\PhpRunnerBundle\Event\HttpServerStartEvent; -use Luzrain\PhpRunnerBundle\Http\HttpRequestHandler; -use Luzrain\PhpRunnerBundle\Internal\WorkerConfigurator; -use Luzrain\PhpRunnerBundle\ReloadStrategy\OnEachRequest; -use Luzrain\PhpRunnerBundle\ReloadStrategy\OnException; -use Luzrain\PhpRunnerBundle\ReloadStrategy\OnMemoryLimit; -use Luzrain\PhpRunnerBundle\ReloadStrategy\OnRequestsLimit; -use Luzrain\PhpRunnerBundle\ReloadStrategy\OnTTLLimit; +use Luzrain\PHPStreamServerBundle\ConfigLoader; +use Luzrain\PHPStreamServerBundle\Event\HttpServerStartEvent; +use Luzrain\PHPStreamServerBundle\Http\HttpRequestHandler; +use Luzrain\PHPStreamServerBundle\Internal\WorkerConfigurator; +use Luzrain\PHPStreamServerBundle\ReloadStrategy\OnEachRequest; +use Luzrain\PHPStreamServerBundle\ReloadStrategy\OnException; +use Luzrain\PHPStreamServerBundle\ReloadStrategy\OnMemoryLimit; +use Luzrain\PHPStreamServerBundle\ReloadStrategy\OnRequestsLimit; +use Luzrain\PHPStreamServerBundle\ReloadStrategy\OnTTLLimit; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; diff --git a/tests/App/Kernel.php b/tests/App/Kernel.php index 0455c9a..31644dc 100644 --- a/tests/App/Kernel.php +++ b/tests/App/Kernel.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Test\App; +namespace Luzrain\PHPStreamServerBundle\Test\App; -use Luzrain\PhpRunnerBundle\PhpRunnerBundle; +use Luzrain\PHPStreamServerBundle\PHPStreamServerBundle; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\Config\Loader\LoaderInterface; @@ -20,7 +20,7 @@ public function registerBundles(): iterable { return [ new FrameworkBundle(), - new PhpRunnerBundle(), + new PHPStreamServerBundle(), ]; } @@ -40,7 +40,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void ->addTag('routing.route_loader') ; - $container->loadFromExtension('phprunner', [ + $container->loadFromExtension('phpstreamserver', [ 'servers' => [ [ 'name' => 'Test server', diff --git a/tests/App/RequestTestController.php b/tests/App/RequestTestController.php index 83a99c3..f5b0c62 100644 --- a/tests/App/RequestTestController.php +++ b/tests/App/RequestTestController.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Test\App; +namespace Luzrain\PHPStreamServerBundle\Test\App; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\File\UploadedFile; diff --git a/tests/App/TestProcess.php b/tests/App/TestProcess.php index ebe88d8..c6083c5 100644 --- a/tests/App/TestProcess.php +++ b/tests/App/TestProcess.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Test\App; +namespace Luzrain\PHPStreamServerBundle\Test\App; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; diff --git a/tests/App/TestTask.php b/tests/App/TestTask.php index 462a905..015d266 100644 --- a/tests/App/TestTask.php +++ b/tests/App/TestTask.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Test\App; +namespace Luzrain\PHPStreamServerBundle\Test\App; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; diff --git a/tests/App/index.php b/tests/App/index.php index 9070171..4ec17d3 100644 --- a/tests/App/index.php +++ b/tests/App/index.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use Luzrain\PhpRunnerBundle\Test\App\Kernel; +use Luzrain\PHPStreamServerBundle\Test\App\Kernel; require_once \dirname(__DIR__, 2) . '/vendor/autoload_runtime.php'; diff --git a/tests/ProcessTest.php b/tests/ProcessTest.php index 36a4cc7..e00a23b 100644 --- a/tests/ProcessTest.php +++ b/tests/ProcessTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Test; +namespace Luzrain\PHPStreamServerBundle\Test; use Revolt\EventLoop\Driver\StreamSelectDriver; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; diff --git a/tests/RequestTest.php b/tests/RequestTest.php index 8317180..75b532d 100644 --- a/tests/RequestTest.php +++ b/tests/RequestTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Test; +namespace Luzrain\PHPStreamServerBundle\Test; use GuzzleHttp\Client; use GuzzleHttp\Cookie\CookieJar; diff --git a/tests/ServicesAutowiringTest.php b/tests/ServicesAutowiringTest.php index 351d409..4367ff4 100644 --- a/tests/ServicesAutowiringTest.php +++ b/tests/ServicesAutowiringTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Test; +namespace Luzrain\PHPStreamServerBundle\Test; -use Luzrain\PhpRunnerBundle\Http\HttpRequestHandler; -use Luzrain\PhpRunnerBundle\Internal\WorkerConfigurator; +use Luzrain\PHPStreamServerBundle\Http\HttpRequestHandler; +use Luzrain\PHPStreamServerBundle\Internal\WorkerConfigurator; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Console\Application; diff --git a/tests/TaskTest.php b/tests/TaskTest.php index 6144d5d..5cd29c4 100644 --- a/tests/TaskTest.php +++ b/tests/TaskTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Luzrain\PhpRunnerBundle\Test; +namespace Luzrain\PHPStreamServerBundle\Test; use Revolt\EventLoop\Driver\StreamSelectDriver; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;