Icicle is a PHP library for writing asynchronous code using synchronous coding techniques.

Icicle uses coroutines built with awaitables to facilitate writing asynchronous code using techniques normally used to write synchronous code, such as returning values and throwing exceptions. Writing functions in this way allows you to focus on the meaning of your code, without a mess of nested callbacks.

Features

  • Full-featured event loop for asynchronous programming
  • Multiple event loop backends
  • Asynchronous TCP and UDP sockets
  • Asynchronous DNS resolution
  • Standalone HTTP server
  • Multi-processing using forking or child processes
  • Multi-threading using native threads
  • Asynchronous process signal handling
  • Worker pool for running blocking tasks
  • Non-blocking concurrency primitives

Core Components

  • Event loop: The core of Icicle that manages scheduling incoming events and asynchronous functions.
  • Awaitables: Placeholders for future values of asynchronous operations. Callbacks registered with awaitables may return values and throw exceptions.
  • Coroutines: Interruptible functions for building asynchronous code using synchronous coding patterns and error handling.

Optional Packages

  • Stream: Common coroutine-based interface for reading and writing data.
  • Socket: Asynchronous stream socket server and client.
  • Concurrent: Provides an easy to use interface for parallel execution with non-blocking communication and task execution.
  • DNS: Asynchronous DNS resolver and connector.
  • Filesystem: Asynchronous filesystem access (under development).
  • HTTP: Asynchronous HTTP server and client (under development).
  • WebSocket: Asynchronous WebSocket server and client (under development).
  • React Adapter: Adapts the event loop and awaitables of Icicle to interfaces compatible with components built for React.

Getting help and support

If you're experiencing problems or find anything in this documentation that is confusing or misleading, you can find help and support in the following ways:

License

The Icicle library, all related packages, and documentation are licensed under the MIT license. View the license file for details.

Next: About the Documentation