# Settings

MadelineProto has lots of settings that can be used to modify the behaviour of the library.
These settings are controlled by the following classes:

These classes can be instantiated and passed individually to MadelineProto:

$settings = (new \danog\MadelineProto\Settings\Database\Mysql)
    ->setUri('tcp://localhost')
    ->setPassword('pass');

$API = new \danog\MadelineProto\API('session.madeline', $settings);

To modify the settings of an already created instance, updateSettings must be used, as passing them to the constructor won’t work for performance reasons:

$settings = (new \danog\MadelineProto\Settings\Database\Postgres)
    ->setUri('tcp://localhost')
    ->setPassword('pass');


$MadelineProto->updateSettings($settings);

It’s recommended you create a separate file that accesses the session just to modify the settings, as it’s a very rare operation.

You can also group settings in a single \danog\MadelineProto\Settings object, to quickly modify multiple settings:

$settings = new \danog\MadelineProto\Settings;
$settings->setDb((new \danog\MadelineProto\Settings\Database\Mysql)
    ->setUri('tcp://localhost')
    ->setPassword('pass')
);
$settings->getFiles()->setUploadParallelChunks(100);

$MadelineProto->updateSettings($settings);

Next section

This site uses cookies, as described in the cookie policy. By clicking on "Accept" you consent to the use of cookies.