PHPackages                             kzykhys/coroutine-io - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. kzykhys/coroutine-io

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

kzykhys/coroutine-io
====================

Fast socket server implementation using \*Generator\*

v0.1.0(12y ago)5101[2 issues](https://github.com/kzykhys/CoroutineIO/issues)1MITPHPPHP &gt;=5.5.0

Since Nov 27Pushed 12y ago2 watchersCompare

[ Source](https://github.com/kzykhys/CoroutineIO)[ Packagist](https://packagist.org/packages/kzykhys/coroutine-io)[ RSS](/packages/kzykhys-coroutine-io/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

CoroutineIO
===========

[](#coroutineio)

[![Latest Stable Version](https://camo.githubusercontent.com/b0d3a9f70983b26cb9b02f69775e62d671e3719f5a44425750837e42bb775ebb/68747470733a2f2f706f7365722e707567782e6f72672f6b7a796b6879732f636f726f7574696e652d696f2f762f737461626c652e706e67)](https://packagist.org/packages/kzykhys/coroutine-io)[![Build Status](https://camo.githubusercontent.com/f4e67d721ee645149b15f8c84bebfbf0d6c643a710de78c2bfd1e755cfda0179/68747470733a2f2f7472617669732d63692e6f72672f6b7a796b6879732f436f726f7574696e65494f2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/kzykhys/CoroutineIO)

Fast socket server implementation using *Generator*. This project is heavily inspired by @nikic's [great post](http://nikic.github.io/2012/12/22/Cooperative-multitasking-using-coroutines-in-PHP.html "Cooperative multitasking using coroutines (in PHP!)").

Following project shows the possibility of CoroutineIO.

- [kzykhys/coupe](https://github.com/kzykhys/coupe) - Coupé - A Handy HTTP/HTTPS Server written in *PURE* PHP

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

[](#requirements)

- PHP5.5+

Installation
------------

[](#installation)

Create or update your composer.json and run `composer update`

```
{
    "require": {
        "kzykhys/coroutine-io": "~0.1.0"
    }
}
```

Example (HTTP Server)
---------------------

[](#example-http-server)

1. Run `php example.php`
2. Open `http://localhost:8000` in browser and hold down the F5 key
3. Watch the console output

```
php example.php

```

```
::1:50531
GET / HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ja,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive

```

### example.php

[](#examplephp)

```
