Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

4. Installation

Albert Chen edited this page May 6, 2018 · 11 revisions

Installation

This package relies on Swoole extension. Make sure you've installed Swoole before you use 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 an extension=swoole.so line before you use it.

php -i | grep php.ini                      # check the php.ini file location
sudo echo "extension=swoole.so" > php.ini  # add the 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 supoorts 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, you can skip this step.

If you are using Laravel, add the service provider to the providers array in config/app.php:

[
    'providers' => [
        SwooleTW\Http\LaravelServiceProvider::class,
    ],
]

If you are using Lumen, append the following code to bootstrap/app.php:

$app->register(SwooleTW\Http\LumenServiceProvider::class);
Clone this wiki locally