Get Mystery Box with random crypto!

> What is AMPHP (https://amphp.org)? Amp is a non-blocking co | MadelineProto | Official Channel

> What is AMPHP (https://amphp.org)?

Amp is a non-blocking concurrency framework for PHP providing primitives to manage concurrency such as an event loop, promises, and asynchronous iterators.

> OK, in simpler words?

AMPHP is a high-performance, parallelized PHP library that allows you to write extremely fast, efficient programs that work in parallel using green threads.

> * b r a i n m e l t *

Y E S

———

MadelineProto is not written in PHP: MadelineProto is written using AMPHP.
What this means is that when you using MadelineProto (and async is enabled), all incoming messages are handled in parallel, each in a separate thread, even on webhosts.

This allow your bots to always be responsive, even while executing complex tasks.

However, it is vital that you also use AMPHP (not PHP!) when writing your bot.
What this means is that the following PHP functions and extensions cannot be used in MadelineProto bots (otherwise, all the benefits of AMPHP would be nullified): instead, you must use the correct AMPHP library (automatically included in madeline.php).

file_get_contents
amphp/file for files, amphp/http-client and $MadelineProto->fileGetContents for URLs

curl, guzzle
amphp/http-client is async, much faster than other libraries, and also supports HTTP/2!

mysqli, PDO, sqlite
amphp/mysql supports both MySQL and SQLite backends, and is fully async!
You can also use amphp/postgres and amphp/redis for PostgreSQL and Redis!

php-fpm
amphp/http-server is a high-performance async HTTP/2 server, that can be interfaced with MadelineProto to create file download servers!

include, require
Don't use this function very often, and most importantly, don't use it inside of the event handler code.
You should use it only once on bot startup, or else when reloading the bot (plugin source coming soon!)

———

In short, AMPHP is an awesome framework for using async PHP in 2020: you can join the official Telegram support group @amphpchat if you have any questions or suggestions on what else to add to AMPHP!