PHP Classes

PHP Multiplexed I/O: Manage multiple simultaneous network connections

Recommend this page to a friend!
  Info   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 67%Total: 1,111 All time: 3,382 This week: 350Up
Version License PHP version Categories
phpmio 0.1BSD License5.2Networking, PHP 5, Files and Folders


This package can be used to manage multiple simultaneous network connections or file accesses. It is loosely based on the selectable channels implementation from Java's NIO package.

It can create streams to access files, access network servers or accept connections from network clients.

The streams can be set to non-blocking mode, so this package can manage the access to data read or written to multiple streams simultaneously.

It can register selectors for all the streams, so it can wait and handle the data read or written to multiple streams when it is ready.

Innovation Award
PHP Programming Innovation award nominee
April 2007
Number 4
Some applications require retrieving information from many sources, like files or remote network connections.

Using synchronous access, a regular script can only access one data source at a time. If a script needs to poll multiple sources, not only it may take a lot of time, but waiting from one source to respond may halt the script forever.

An alternative approach to retrieve data from many sources is to use asynchronous access to poll many sources at the same time. This way it does not block the applications from doing parallel processing while waiting for the data to come.

This package provides a solution that uses non-blocking streams to provide simultaneous access to multiple files or network connections for any PHP application.

Manuel Lemos
Picture of Robert Young
Name: Robert Young <contact>
Classes: 2 packages by
Country: United Kingdom
Age: 43
All time rank: 197586 in United Kingdom
Week rank: 410 Up16 in United Kingdom Up
Innovation award
Innovation award
Nominee: 2x

  Files folder image Files  
File Role Description
Files folder imageexample (2 files)
Files folder imagetests (4 files)
Plain text file Exception.php Class Exception classes
Plain text file SelectionKey.php Class Contains the SelectionKey class
Plain text file Selector.php Class Contains the Selector class
Plain text file Stream.php Class Contains the Stream class
Plain text file StreamFactory.php Class Contains the StreamFactory class

  Files folder image Files  /  example  
File Role Description
  Accessible without login Plain text file downloader.php Example Example of downloading multiple files
  Accessible without login Plain text file riddler.php Example Self contained example

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file SelectionKeyTest.php Test Unit test for SelectionKey class
  Accessible without login Plain text file SelectorTest.php Test Unit test for Selector class
  Accessible without login Plain text file StreamFactoryTest.php Test Unit test for StreamFactory class
  Accessible without login Plain text file StreamTest.php Test Unit test for StreamTest

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:3,382
This week:350Up
 User Ratings  
 All time