MadelineProto now features async, for incredible speed improvements, and parallel processing.
Powered by amphp, MadelineProto wraps the AMPHP APIs to provide a simpler generator-based async API.
What exactly is async, you may ask, and how is it better than threading or multiprocessing?
Async is a relatively new programming pattern that allows you to easily write non-blocking code as if you were using standard blocking functions.
More simply put: with MadelineProto 4.0, each update is handled in parallel using a separate thread, and everything is MUCH faster (even on restricted webhosts; this is perfect for creating file downloader bots!).
To enable async, you have to do two simple things:
1) Load the latest version of MadelineProto
2) yield your method calls.
That's it!
No need to set up thread pools, use synchronization primitives, and so on...
Just
yield $MadelineProto->messages->sendMessage instead of $MadelineProto->messages->sendMessage.