Added serialization docs
This commit is contained in:
parent
0c68e58103
commit
d5f02639d8
11
README.md
11
README.md
@ -351,7 +351,16 @@ See testing.php for more examples.
|
||||
|
||||
### Storing sessions
|
||||
|
||||
An istance of MadelineProto can be safely serialized or unserialized.
|
||||
An istance of MadelineProto can be safely serialized or unserialized. To serialize MadelineProto to a file, usage of the `\danog\MadelineProto\Serialization` class is recommended:
|
||||
|
||||
```
|
||||
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('session.madeline');
|
||||
// Do stuff
|
||||
\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto);
|
||||
```
|
||||
|
||||
That class serializes only if the `$MadelineProto->API->should_serialize` boolean is set to true.
|
||||
The same operation should be done when serializing to another destination manually, to avoid conflicts with other PHP scripts that are trying to serialize another instance of the class.
|
||||
|
||||
### Exceptions
|
||||
|
||||
|
@ -355,7 +355,16 @@ See testing.php for more examples.
|
||||
|
||||
### Storing sessions
|
||||
|
||||
An istance of MadelineProto can be safely serialized or unserialized.
|
||||
An istance of MadelineProto can be safely serialized or unserialized. To serialize MadelineProto to a file, usage of the `\danog\MadelineProto\Serialization` class is recommended:
|
||||
|
||||
```
|
||||
$MadelineProto = \danog\MadelineProto\Serialization::deserialize('session.madeline');
|
||||
// Do stuff
|
||||
\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto);
|
||||
```
|
||||
|
||||
That class serializes only if the `$MadelineProto->API->should_serialize` boolean is set to true.
|
||||
The same operation should be done when serializing to another destination manually, to avoid conflicts with other PHP scripts that are trying to serialize another instance of the class.
|
||||
|
||||
### Exceptions
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user