Skip to content

b-viguier/Slip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slip

Proof of concept of asynchronous programming with Php 8.1 and Fiber.

Slip (pronounced like "sleep" in english) is a nano framework providing a non-blocking sleep function.

Slip has been presented in a short talk at ForumPhp 2021 (fr).

How to install

Don't. It's just a one file library for demonstration purpose only. If you want to try it in your own project, just copy the Slip.php file.

How to use it

⚠️ Requires Php 8.1 ⚠️

Slip contains only 3 (documented) functions:

  • wrap several functions in some Slip\Slipper objects
  • use Slip\sleep() to pause your functions in a non-blocking way
  • run your Slip\Slipper instances concurrently with Slip\Slipper::run().

Some examples are provided, using a Ping Pong analogy.

A ping and a pong functions are executed concurrently in a vanilla Php program.

A small program using Symfony Console Component, providing a ping and a pong commands. First, run composer install to install dependencies, then you can execute commands individually (with php console.php <cmd> <count>) or concurrently (with php console.php ping-pong <count>).

Previous example launches 1 application with several concurrent commands, but this one launches several concurrent applications with a single command. Be sure to install dependencies, then run it with php ping-pong.php.

About the name Slip

It's a lame french joke, no offense… We are not looking for a logo.

About

Proof of concept of asynchronous programming with Php8.1 and Fibers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages