Installation

This package relies on Swoole extension. Make sure you've installed Swoole before using this package. Using this command to install it quickly:

  1. pecl install swoole

After installing the extension, you will need to edit php.ini and add extension=swoole.so line before using it.

  1. php -i | grep php.ini # check the php.ini file location
  2. sudo echo "extension=swoole.so" >> php.ini # append "extension=swoole.so" to the end of php.ini
  3. php -m | grep swoole # check if the Swoole extension has been enabled

Visit the official website for more information.

Notice: Swoole currently only supports Linux and OSX. Windows servers are not able to use Swoole yet.

Require this package with composer:

  1. $ composer require swooletw/laravel-swoole

Then, add the service provider:

It supports Package Auto Discovery. If your Laravel version is above 5.5, please skip this step.

If using Laravel, add the Service Provider to the providers array in config/app.php:

  1. [
  2. 'providers' => [
  3. SwooleTW\Http\LaravelServiceProvider::class,
  4. ],
  5. ]

If using Lumen, append the following line to bootstrap/app.php:

  1. $app->register(SwooleTW\Http\LumenServiceProvider::class);