Installation
Official docs: open_in_new Installation .
Sessions
To store account session data and avoid logging in again, the session must be serialized.
A MadelineProto session is automatically serialized every $MadelineProto->settings['serialization']['serialization_interval'] seconds (30 seconds by default), and on shutdown. If the script shuts down normally (without Ctrl+C or fatal errors/exceptions), the session is also serialized automatically.
Create the session and set the serialization destination file:
$MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings);
// The session will be serialized to session.madeline
Load a serialized session the same way:
$MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings);
// The session will be loaded from session.madeline
Change the session file after starting MadelineProto:
$MadelineProto->session = 'newsession.madeline';
API ID and hash
You must register an application (it is tied to a Telegram account). Do that at open_in_new my.telegram.org .
You will get two values:
api_id
api_hash
Andrew Dorokhov