Skip to content

Symfony bundle for PHPStreamServer

Notifications You must be signed in to change notification settings

phpstreamserver/symfony

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPStreamServer logo

Symfony Bundle for PHPStreamServer

PHP >=8.2 Version Downloads

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