Skip to content

Commit

Permalink
Updating links and examples to use Swoole instead of OpenSwoole
Browse files Browse the repository at this point in the history
  • Loading branch information
CViniciusSDias authored Apr 9, 2024
1 parent 995f141 commit 4fdd3c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions src/swoole-nyholm/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Swoole Runtime with nyholm/psr7

A runtime for [Swoole](https://www.swoole.co.uk/).
A runtime for [Swoole](https://www.swoole.com/).

If you are new to the Symfony Runtime component, read more in the [main readme](https://github.com/php-runtime/runtime).

Expand All @@ -26,7 +26,7 @@ APP_RUNTIME=Runtime\SwooleNyholm\Runtime
use Swoole\Http\Request;
use Swoole\Http\Response;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';

return function () {
return function (Request $request, Response $response) {
Expand All @@ -46,7 +46,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';

class App implements RequestHandlerInterface {
public function handle(ServerRequestInterface $request): ResponseInterface {
Expand All @@ -62,14 +62,14 @@ return function(): RequestHandlerInterface {

## Using Options

You can define some configurations using Symfony's Runtime `APP_RUNTIME_OPTIONS` API.
You can define some configurations using Symfony's Runtime [`APP_RUNTIME_OPTIONS` API](https://symfony.com/doc/current/components/runtime.html#using-options).

| Option | Description | Default |
| --- | --- | --- |
| `host` | The host where the server should binds to (precedes `SWOOLE_HOST` environment variable) | `127.0.0.1` |
| `port` | The port where the server should be listing (precedes `SWOOLE_PORT` environment variable) | `8000` |
| `mode` | Swoole's server mode (precedes `SWOOLE_MODE` environment variable) | `SWOOLE_PROCESS` |
| `settings` | All Swoole's server settings ([swoole.co.uk/docs/modules/swoole-server/configuration](https://www.swoole.co.uk/docs/modules/swoole-server/configuration)) | `[]` |
| `settings` | All Swoole's server settings ([wiki.swoole.com/en/#/server/setting](https://wiki.swoole.com/en/#/server/setting) and [wiki.swoole.com/en/#/http_server?id=configuration-options](https://wiki.swoole.com/en/#/http_server?id=configuration-options)) | `[]` |

```php
// public/index.php
Expand All @@ -81,13 +81,13 @@ $_SERVER['APP_RUNTIME_OPTIONS'] = [
'port' => 9501,
'mode' => SWOOLE_BASE,
'settings' => [
\Swoole\Constant::OPTION_WORKER_NUM => swoole_cpu_num() * 2,
\Swoole\Constant::OPTION_ENABLE_STATIC_HANDLER => true,
\Swoole\Constant::OPTION_DOCUMENT_ROOT => dirname(__DIR__).'/public'
'worker_num' => swoole_cpu_num() * 2,
'enable_static_handler' => true,
'document_root' => dirname(__DIR__) . '/public'
],
];

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';

return function (array $context) {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
Expand Down
18 changes: 9 additions & 9 deletions src/swoole/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Swoole Runtime

A runtime for [Swoole](https://www.swoole.co.uk/).
A runtime for [Swoole](https://www.swoole.com/).

If you are new to the Symfony Runtime component, read more in the [main readme](https://github.com/php-runtime/runtime).

Expand All @@ -26,7 +26,7 @@ APP_RUNTIME=Runtime\Swoole\Runtime
use Swoole\Http\Request;
use Swoole\Http\Response;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';

return function () {
return function (Request $request, Response $response) {
Expand All @@ -43,7 +43,7 @@ return function () {

use App\Kernel;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';

return function (array $context) {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
Expand All @@ -52,14 +52,14 @@ return function (array $context) {

## Using Options

You can define some configurations using Symfony's Runtime `APP_RUNTIME_OPTIONS` API.
You can define some configurations using Symfony's Runtime [`APP_RUNTIME_OPTIONS` API](https://symfony.com/doc/current/components/runtime.html#using-options).

| Option | Description | Default |
| --- | --- | --- |
| `host` | The host where the server should binds to (precedes `SWOOLE_HOST` environment variable) | `127.0.0.1` |
| `port` | The port where the server should be listing (precedes `SWOOLE_PORT` environment variable) | `8000` |
| `mode` | Swoole's server mode (precedes `SWOOLE_MODE` environment variable) | `SWOOLE_PROCESS` |
| `settings` | All Swoole's server settings ([swoole.co.uk/docs/modules/swoole-server/configuration](https://www.swoole.co.uk/docs/modules/swoole-server/configuration)) | `[]` |
| `settings` | All Swoole's server settings ([wiki.swoole.com/en/#/server/setting](https://wiki.swoole.com/en/#/server/setting) and [wiki.swoole.com/en/#/http_server?id=configuration-options](https://wiki.swoole.com/en/#/http_server?id=configuration-options)) | `[]` |

```php
// public/index.php
Expand All @@ -71,13 +71,13 @@ $_SERVER['APP_RUNTIME_OPTIONS'] = [
'port' => 9501,
'mode' => SWOOLE_BASE,
'settings' => [
\Swoole\Constant::OPTION_WORKER_NUM => swoole_cpu_num() * 2,
\Swoole\Constant::OPTION_ENABLE_STATIC_HANDLER => true,
\Swoole\Constant::OPTION_DOCUMENT_ROOT => dirname(__DIR__).'/public'
'worker_num' => swoole_cpu_num() * 2,
'enable_static_handler' => true,
'document_root' => dirname(__DIR__) . '/public'
],
];

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';

return function (array $context) {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
Expand Down

0 comments on commit 4fdd3c2

Please sign in to comment.