Swoole Symfony Integration Guide


The community is asking for how to use Swoole with Symfony and how to integrate a Symfony project with Open Swoole.

Swoole libraries for Symfony

Symfony Swoole Bundle:



  • Built-in API Server
  • Swoole Bundle API Server allows to manage Swoole HTTP Server in real time.
  • Improved static files serving
  • Hot Module Reload (HMR) - for development
  • Symfony Messenger integration

It is a solution to integrate Symfony with Swoole to speed up your applications.

  1. Installation:
composer create-project symfony/skeleton project
cd ./project
composer require k911/swoole-bundle
  1. Update config file config/bundles.php:
return [
    // ...other bundles
    K911\Swoole\Bridge\Symfony\Bundle\SwooleBundle::class => ['all' => true],
  1. Start Swoole HTTP server
bin/console swoole:server:run
Symfony Swoole Bridge Bundle:


  1. Installation:
composer require insidestyles/swoole-bridge-bundle

  1. Update config.yml
        port: "%web_server_port%"      #The port the socket server will listen on
        host: "%web_server_host%"
  1. Update AppKernel
    new Insidestyles\SwooleBridgeBundle\SwooleBridgeBundle(),
  1. Start Swoole HTTP server
php bin/console swoole:bridge:server