Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/robsantossilva/config-swoole-in-laravel

Configurando Swoole no Laravel
https://github.com/robsantossilva/config-swoole-in-laravel

laravel laravel7 swoole swooletw

Last synced: about 2 months ago
JSON representation

Configurando Swoole no Laravel

Awesome Lists containing this project

README

        


Build Status
Total Downloads
Latest Stable Version
License

## Configurando Swoole no Laravel

#### Prérequisitos
Laravel >= 5.6

#### Instalando a extensão
``` bash
$ pecl install swoole

$ touch /usr/local/etc/php/conf.d/swoole.ini && \
echo 'extension=swoole.so' > /usr/local/etc/php/conf.d/swoole.ini
```

#### Instale o pacote
``` bash
composer require swooletw/laravel-swoole
```

#### Gerando arquivos de configuração
``` bash
$ php artisan vendor:publish --tag=laravel-swoole
```

/config/swoole_http.php
/config/swoole_websocket.php
/routes/websocket.php

#### Comandos

> O swoole_http_server pode ser executado apenas no ambiente cli, e este pacote fornece comandos artesanais convenientes para gerenciá-lo.
> Por padrão, você pode visitar seu site em http://127.0.0.1:1215

> `php artisan swoole:http {start|stop|restart|reload|infos}`

| Command | Description |
| --------- | --------- |
| `start` | Start Laravel Swoole, list the processes by *ps aux|grep swoole* |
| `stop` | Stop Laravel Swoole |
| `restart` | Restart Laravel Swoole |
| `reload` | Reload all worker process(Contain your business & Laravel/Lumen codes), excluding master/manger process |
| `infos` | Show PHP and Swoole basic miscs infos(including PHP version, Swoole version, Laravel version, server status and PID) |

Agora, você pode executar o seguinte comando para iniciar o servidor HTTP Swoole.

```
$ php artisan swoole:http start
```

Você pode mostrar suas informações básicas executando

```
$ php artisan swoole:http infos
```

```
+-----------------+-------------------------------------------------------------+
| Name | Value |
+-----------------+-------------------------------------------------------------+
| PHP Version | 7.1.14 |
| Swoole Version | 2.1.1-alpha |
| Laravel Version | 5.6.17 |
| Server Status | Online |
| Listen IP | 127.0.0.1 |
| Listen Port | 1215 |
| Websocket Mode | On |
| PID | 3956 |
| Log Path | /Users/Albert/Projects/laravel/storage/logs/swoole_http.log |
+-----------------+-------------------------------------------------------------+
```