92

GitHub - k911/swoole-bundle: Symfony Swoole Bundle

 4 years ago
source link: https://github.com/k911/swoole-bundle
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

Swoole Bundle

CircleCI travis codecov Maintainability Test Coverage Open Source Love MIT Licence


Symfony integration with Swoole to speed up your applications.

Quick start guide

  1. Make sure you have installed proper Swoole PHP Extension and pass other requirements.

  2. (optional) Create a new symfony project

    composer create-project symfony/skeleton project
    
    cd ./project
  3. Install bundle in your symfony application

    composer require k911/swoole-bundle
  4. Edit config/bundles.php

    return [
        // ...other bundles
        K911\Swoole\Bridge\Symfony\Bundle\SwooleBundle::class => ['all' => true],
    ];
  5. Run Swoole HTTP Server

    bin/console swoole:server:run
  6. Enter http://localhost:9501

  7. You can now configure bundle according to your needs

Features

  • Built-in API Server

    Swoole Bundle API Server allows to manage Swoole HTTP Server in real time.

    • Reload worker processes
    • Shutdown server
    • Access metrics and settings
  • Improved static files serving

    Swoole HTTP Server provides a default static files handler, but it lacks supporting many Content-Types. In order to overcome this issue, there is (not yet configurable) Advanced Static Files Server. Static files serving is enabled by default in development environment. Static files directory defaults to %kernel.project_dir%/public.

  • Hot Module Reload (HMR) - for development

    Since Swoole HTTP Server runs in Event Loop and do not flush memory between requests, to keep DX equal with normal servers, this bundle uses code replacement techinque, using inotify PHP Extension to allow contionus development. It is enabled by default (when extension is found), and requires no additional configuration. You can turn it off in bundle configuration.

Requirements

  • Swoole PHP Extension ^4.3.0
  • Symfony ^4.2

Additional requirements to enable specific features:

Swoole

Bundle requires Swoole PHP Extension version 4.3.0 or higher. Active bug fixes are provided only for latest version.

Version check

To check your installed version you can run following command:

php -r "echo swoole_version();"

# 4.3.3

Installation

To install latest version of swoole use pecl:

pecl install swoole

Or, to skip interactive questions:

echo "\n" | pecl install swoole

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK