phpstreamserver / symfony
Symfony bundle for PHPStreamServer
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Type:symfony-bundle
Requires
- php: >=8.2
- ext-pcntl: *
- ext-posix: *
- phpstreamserver/core: ^0.4
- phpstreamserver/http-server: ^0.4
- symfony/config: ^7.0
- symfony/dependency-injection: ^7.0
- symfony/dotenv: ^7.0
- symfony/http-kernel: ^7.0
- symfony/runtime: ^7.0
README
Symfony Bundle for PHPStreamServer
This bundle provides a PHPStreamServer integration with the Symfony framework to run your application in a highly efficient event-loop based runtime.
Getting started
Install composer packages
$ composer require phpstreamserver/symfony
Enable the bundle
// config/bundles.php return [ // ... PHPStreamServer\Symfony\PHPStreamServerBundle::class => ['all' => true], ];
Create phpss.config.php file in the config directory
# config/phpss.config.php use PHPStreamServer\Core\ReloadStrategy\ExceptionReloadStrategy; use PHPStreamServer\Core\Server; use PHPStreamServer\Symfony\Worker\SymfonyHttpServerProcess; return static function (Server $server): void { $server->addWorker(new SymfonyHttpServerProcess( listen: '0.0.0.0:80', count: 1, reloadStrategies: [ new ExceptionReloadStrategy(), ], )); };
Create phpss file in the bin directory
# bin/phpss use App\Kernel; use PHPStreamServer\Symfony\PHPStreamServerRuntime; $_SERVER['APP_RUNTIME'] = PHPStreamServerRuntime::class; require_once \dirname(__DIR__).'/vendor/autoload_runtime.php'; return function (array $context) { return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); };
Start the server
$ bin/phpss start