MadelineProto was updated!
MadelineProto 6 introduces ultra-fast startup with a built-in IPC server, PHP transpilation using phabel.io, MySQL/Postgres/redis database support to reduce RAM usage, and new, IDE-friendly settings.
The main event:
- MadelineProto is now transpiled using phabel.io!
Phabel.io is a PHP transpiler that allows native usage of PHP 8+ features in projects and libraries, while allowing maintainers to publish a version targeting lower versions of php.
Async await syntax is also supported!
Usage:
composer require --dev phabel/phabel
You can now publish your packagist package, and it will be automatically transpiled to any PHP version supported by phabel.
After git tagging a new release, just run:
vendor/bin/phabel publish
💡 Your PHP 7 users can now install your PHP 8 library 💡
💡 All your dependencies will also be transpiled to the correct PHP version. 💡
Supported PHP versions:
Syntax/feature support:
- ✅ 8.0+
- async/await syntax
Target:
-
✅ 7.1+
-
🐘 5.6, 7.0 in final testing stage.
-
💡 5.4, 5.5 support coming soon!
-
Now MadelineProto has a built-in IPC server, this means:
Very fast startup for small scripts: ~0.02 seconds, before was 1-5 seconds
To use this IPC server, just use MadelineProto normally:
$API = new \danog\MadelineProto\API('session.madeline');
$API->start();
$API->messages->sendMessage(['peer' => $_POST['peer'], 'message' => $_POST['message']]);
This is useful for small sendMessage.php scripts, to be called from outside; for maximum performance in bots use an async event handler.
- New IDE-friendly settings API!
- Async MySQL/Postgres/redis integration:
Use a database to reduce memory usage to 1-5 MB even for thousands of groups!
See here for examples and documentation.
Native database integration in the event handler is also now supported!
Other brand-new features in MadelineProto 6:
- New PHP API documentation
- Updated Telegram API to layer 131
- Updated tg-file-decoder library
- New localization keys for all UI elements
- New settings for custom HTML, Javascript and CSS in login page templates
- New PSR logger API
- New session conversion API
Coming up soon: **** **IP implementation ;)
Internal improvements:
- Many, many bugfixes, stability fixes and performance improvements
- RPC requests are containerized by default, when possible
- Complete refactoring of MTProto message subsystem
- Added a periodic garbage collector
- Implemented native PHP prime factorization (C++ factorization is still recommended using https://prime.madelineproto.xyz)