Installation
This package relies on Swoole extension. Make sure you've installed Swoole before using this package. Using this command to install it quickly:
pecl install swoole
After installing the extension, you will need to edit php.ini
and add extension=swoole.so
line before using it.
php -i | grep php.ini # check the php.ini file location
sudo echo "extension=swoole.so" >> php.ini # append "extension=swoole.so" to the end of php.ini
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:
$ 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
:
- [
- 'providers' => [
- SwooleTW\Http\LaravelServiceProvider::class,
- ],
- ]
If using Lumen, append the following line to bootstrap/app.php
:
- $app->register(SwooleTW\Http\LumenServiceProvider::class);