PHPackages                             pachico/slim-swoole - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. pachico/slim-swoole

AbandonedArchivedLibrary[Framework](/categories/framework)

pachico/slim-swoole
===================

Convenient library to run SlimPHP applications with Swoole

0.3.0(6y ago)9110.2k14[2 issues](https://github.com/pachico/slim-swoole/issues)MITPHPPHP ^7.0

Since Feb 10Pushed 5y ago9 watchersCompare

[ Source](https://github.com/pachico/slim-swoole)[ Packagist](https://packagist.org/packages/pachico/slim-swoole)[ Docs](https://github.com/pachico/slim-swoole)[ RSS](/packages/pachico-slim-swoole/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (6)Versions (8)Used By (0)

slim-swoole
===========

[](#slim-swoole)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/cd238fc232273cb82d3e1376f099aaa4455ba31c08c07690c81140988e32cefa/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7061636869636f2f736c696d2d73776f6f6c652f6261646765732f7175616c6974792d73636f72652e706e673f623d302e782d646576)](https://scrutinizer-ci.com/g/pachico/slim-swoole/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/8c93a4f3d56a26ff3aeb9ca0754719cdf9ee9a5b10ca59cebf884a8fa83f3616/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7061636869636f2f736c696d2d73776f6f6c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pachico/slim-swoole/?branch=master)[![Build Status](https://camo.githubusercontent.com/aa9cb4c2564a7ee6b7e5656100121e2ba48490bb7fc3e613388bfd522b237f61/68747470733a2f2f7472617669732d63692e6f72672f7061636869636f2f736c696d2d73776f6f6c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pachico/slim-swoole)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

This is a brige library to run [Slim framework](https://www.slimframework.com/) Slim framework applications using [Swoole engine](https://www.swoole.co.uk/).

Overview
--------

[](#overview)

The main purpose of this library is to easily run your already existing SlimPHP applications using Swoole Framework. It requires you to bootstrap your application only once when you start Swoole HTTP server and, thanks to its event driven design, it will process each request reusing your already started application for better performance.

The execution sequence is as follows:

1. You bootstrap your SlimPHP application as you would normally do.
2. You instantiate the `BrigeManager` passing to it your SlimPHP application.
3. You start Swoole's HTTP server.
4. You bind to the `on('request')` event handler the `BridgeManager` instance which will:
    1. Transform the Swoole request to a SlimPHP based on server and request attributes.
    2. Process your request through SlimPHP's application stack (including middlewares)
    3. Merge SlimPHP Response to Swoole Response
    4. End the request. All this is done under the hood, so you will just need to call:

```
$bridgeManager->process($swooleRequest, $swooleResponse)->end();
```

(See usage paragraph for a complete example.)

**Caution**: it is still in development so any contribution and test will be more than welcome.

Requirements
------------

[](#requirements)

- PHP-CLI &gt;= 7.0 (Required by Swoole)
- Swoole framework (this has been tested with version 1.10.1)

Install
-------

[](#install)

Via Composer

```
$ composer require pachico/slim-swoole
```

Usage
-----

[](#usage)

```
