1. Go to this page and download the library: Download mateodioev/tgbot library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mateodioev / tgbot example snippets
use Mateodioev\Bots\Telegram\Api;
$api = new Api($bot_token);
use Mateodioev\Bots\Telegram\Types\baseType;
class MyCustomType extends baseType
{
protected array $fields = [
'field1' => 'valueType',
'id' => 'integer', // only accept integer values
'user' => User::class, // only accept arrays or instances of the User class
];
}
// from array
$customType = MyCustomType::createFromArray(['field1' => 'Type', 'id' => 1111, 'user' => $user]);
// From stdClass
$customType = MyCustomType::create((object) ['field1' => 'Type', 'id' => 1111, 'user' => $user]);
// Create from constructor
$customType = new MyCustomType(field1: 'Type', id: 1111, user: $user); // maybe this cause linter errors
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.