The PHP TD Gram Schema generated TdLib Schema Classes using phptdgram/schema-generator from td_api.tl file.
Via Composer
$ composer require phptdgram/schema
<?php
use PHPTdGram\Schema\TdSchemaRegistry;
$input = [
'@type' => 'updateOption',
'name' => 'version',
'value' => [
'@type' => 'optionValueString',
'value' => '1.6.0',
],
];
TdSchemaRegistry::fromArray($input);
Will parse TdLib response to PHP Objects
class PHPTdGram\Schema\UpdateOption#3 (3) {
protected string $name =>
string(7) "version"
protected PHPTdGram\Schema\OptionValue $value =>
class PHPTdGram\Schema\OptionValueString#2 (2) {
protected string $value =>
string(5) "1.6.0"
public ?string $tdExtra =>
NULL
}
public ?string $tdExtra =>
NULL
}
Another example:
<?php
use PHPTdGram\Schema\TdSchemaRegistry;
$input = [
'@extra' => 'foo',
'@type' => 'updateAuthorizationState',
'authorization_state' => [
'@type' => 'authorizationStateWaitTdlibParameters',
],
];
TdSchemaRegistry::fromArray($input);
Will produce:
class PHPTdGram\Schema\UpdateAuthorizationState#3 (2) {
protected PHPTdGram\Schema\AuthorizationState $authorizationState =>
class PHPTdGram\Schema\AuthorizationStateWaitTdlibParameters#2 (1) {
public ?string $tdExtra =>
NULL
}
public ?string $tdExtra =>
string(3) "foo"
}
Run PHP style checker
$ composer cs-check
Run PHP style fixer
$ composer cs-fix
Run all continuous integration tests
$ composer ci-run
Please see CONTRIBUTING and CONDUCT for details.
Please see License File for more information.