Update docs

This commit is contained in:
Daniil Gentili 2020-02-26 18:21:40 +01:00
parent 3b740a4ade
commit 1060a5b402
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -9,12 +9,32 @@ MadelineProto has lots of settings that can be used to modify the behaviour of t
```php ```php
$MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings); $MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings);
$MadelineProto->settings = $settings; $prevSettings = $MadelineProto->getSettings();
$MadelineProto->updateSettings($newSettings);
``` ```
`$settings` - an array that contains some other arrays, which are the settings for a specific MadelineProto function. `$settings` - an array that contains some other arrays, which are the settings for a specific MadelineProto function.
Here are the default values for the settings arrays and explanations for every setting: Here are the default values for the settings arrays and explanations for every setting:
<hr>
You can provide part of any subsetting array, that way the remaining arrays will be automagically set to default and undefined values of specified subsetting arrays will be set to the default values.
Example:
```php
$MadelineProto->updateSettings([
'authorization' => [ // Authorization settings
'default_temp_auth_key_expires_in' => 86400, // a day (for better security, lower is better), will be automatically regenerated afterwards
]
]);
```
The settings array can be accessed using the `getSettings` method of the API class:
```php
$settings = $MadelineProto->getSettings();
```
<hr> <hr>
## `$settings['authorization']` ## `$settings['authorization']`
@ -420,23 +440,4 @@ Default: false
Description: Remove data from internal database to cleanup memory and reduce `*.madeline` file size (may cause MadelineProto errors). Description: Remove data from internal database to cleanup memory and reduce `*.madeline` file size (may cause MadelineProto errors).
<hr> <a href="https://docs.madelineproto.xyz/docs/SELF.html">Next section</a>
You can provide part of any subsetting array, that way the remaining arrays will be automagically set to default and undefined values of specified subsetting arrays will be set to the default values.
Example:
```php
$MadelineProto->settings = [
'authorization' => [ // Authorization settings
'default_temp_auth_key_expires_in' => 86400, // a day
]
]
```
The settings array can be accessed and modified in the instantiated class by accessing the `settings` attribute of the API class:
```php
$MadelineProto->settings['updates']['handle_updates'] = true; // reenable update fetching
```
<a href="https://docs.madelineproto.xyz/docs/SELF.html">Next section</a>