|
1 |
| -# React Symfony Server |
| 1 | +# Symfony ReactPHP Server |
| 2 | + |
| 3 | +This package provides an async server for Symfony kernel based on ReactPHP |
| 4 | +packages and Promise implementation. The server is distributed with all the |
| 5 | +Symfony kernel adapters, and can be easily extended for new Kernel |
| 6 | +modifications. |
| 7 | + |
| 8 | +> At the moment, this server cannot serve static files. This feature will be |
| 9 | +> added soon. |
| 10 | +
|
| 11 | +You can take a look at the |
| 12 | +[Symfony + ReactPHP Series](https://medium.com/@apisearch/symfony-and-reactphp-series-82082167f6fb) |
| 13 | +in order to understand a little bit better the rationale behind using this |
| 14 | +server and Promises in your domain. |
| 15 | + |
| 16 | +## Installation |
| 17 | + |
| 18 | +In order to use this server, you only have to add the requirement in composer. |
| 19 | +Once updated your dependencies, you will find a brand new server bin inside the |
| 20 | +`vendor/bin` folder. |
| 21 | + |
| 22 | +```yml |
| 23 | +{ |
| 24 | + "require": { |
| 25 | + "apisearch-io/symfony-react-server": "dev-master" |
| 26 | + } |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +## Usage |
| 31 | + |
| 32 | +This is a PHP file. This means that the way of starting this server is by, just, |
| 33 | +executing it. |
| 34 | + |
| 35 | +```php |
| 36 | +php vendor/bin/server |
| 37 | +``` |
| 38 | + |
| 39 | +You will find that the server starts with a default configuration. You can |
| 40 | +configure how the server starts and what adapters use. |
| 41 | + |
| 42 | +- Adapter: The kernel adapter for the server. This server needs a Kernel |
| 43 | + instance in order to start serving Requests. By default, `symfony4`. Can be |
| 44 | + overridden with option `--adapter` and the value must be a valid class |
| 45 | + namespace of an instance of `KernelAdapter` |
| 46 | + |
| 47 | +- Bootstrap: How the application is bootstrapped. This would be usually a simple |
| 48 | + autoload require, but sometimes, like in symfony, can be some extra actions |
| 49 | + before the Kernel is instanced. By default, `symfony4`. Available options are |
| 50 | + `Symfony4` and `autoload`. Can be overridden with the option `--bootstrap` and |
| 51 | + the value must be a valid path of a file, starting from the project root. |
| 52 | + |
| 53 | +- Environment: Kernel environment. By default `prod`, but turns `dev` if the |
| 54 | + option `--dev` is found. |
| 55 | + |
| 56 | +- Debug: Kernel will start with this option is enabled. By default false, |
| 57 | + enabled if the option `--debug` is found. |
| 58 | + |
| 59 | +- Silent: No information nor any kind of report will be printed in the standard |
| 60 | + output. By default disabled, but can be enabled with `--silent`. |
| 61 | + |
| 62 | +- Non Blocking: This option enabled async kernel. If this option is not found, |
| 63 | + the server will use the standard `handle` kernel method. Otherwise, will |
| 64 | + use the `handleAsync` method, working in that case, as a non-blocking server. |
0 commit comments