{"id":21477514,"url":"https://github.com/mateodioev/telegram-bot-api","last_synced_at":"2025-07-15T10:33:26.518Z","repository":{"id":41370600,"uuid":"504183917","full_name":"Mateodioev/telegram-bot-api","owner":"Mateodioev","description":"Telegram bot sdk","archived":false,"fork":false,"pushed_at":"2024-10-28T03:27:03.000Z","size":921,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-28T07:02:30.098Z","etag":null,"topics":["php","telegram","telegram-bot","telegram-bot-api"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mateodioev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-16T14:18:23.000Z","updated_at":"2024-06-12T04:28:53.000Z","dependencies_parsed_at":"2022-07-22T19:17:47.753Z","dependency_job_id":"a2116496-036c-40c8-9572-ce7bb6c4295b","html_url":"https://github.com/Mateodioev/telegram-bot-api","commit_stats":{"total_commits":78,"total_committers":4,"mean_commits":19.5,"dds":"0.42307692307692313","last_synced_commit":"62a05207cfc4313c39f317dc76d51a12ea58b03c"},"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mateodioev%2Ftelegram-bot-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mateodioev%2Ftelegram-bot-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mateodioev%2Ftelegram-bot-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mateodioev%2Ftelegram-bot-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mateodioev","download_url":"https://codeload.github.com/Mateodioev/telegram-bot-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226033246,"owners_count":17563126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","telegram","telegram-bot","telegram-bot-api"],"created_at":"2024-11-23T11:14:04.599Z","updated_at":"2024-11-23T11:14:05.195Z","avatar_url":"https://github.com/Mateodioev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Telegram bot api\n\n## Install\n\n```bash\ncomposer require mateodioev/tgbot\n```\n\n```bash\ngit clone https://github.com/Mateodioev/tgbot\n```\n\n## First step\n\n```php\nrequire __DIR__ . 'path/to/vendor/autoload.php';\n```\n\n## Create new Api instance\n\n```php\nuse Mateodioev\\Bots\\Telegram\\Api;\n\n$api = new Api($bot_token);\n```\n\n\n## Send method to telegram api\n\n```php\nuse Mateodioev\\Bots\\Telegram\\Types\\Message;\n\n$message = $api-\u003esendMessage('chat_id', 'Text', $others_params);\n\nvar_dump($message-\u003eget());\nvar_dump($message instanceof Message::class);\n```\n\n## Enable async mode\n\nNote: This use `amphp/http-client`\n\n```php\n$api-\u003esetAsync(true);\n```\n\n## Create new telegram types\n\n```php\nuse Mateodioev\\Bots\\Telegram\\Types\\baseType;\n\nclass MyCustomType extends baseType\n{\n    protected array $fields = [\n        'field1' =\u003e 'valueType',\n        'id'     =\u003e 'integer', // only accept integer values\n        'user'   =\u003e User::class, // only accept arrays or instances of the User class\n    ];\n}\n```\n\n*Create new instance*\n\n```php\n// from array\n$customType = MyCustomType::createFromArray(['field1' =\u003e 'Type', 'id' =\u003e 1111, 'user' =\u003e $user]);\n// From stdClass\n$customType = MyCustomType::create((object) ['field1' =\u003e 'Type', 'id' =\u003e 1111, 'user' =\u003e $user]);\n// Create from constructor\n$customType = new MyCustomType(field1: 'Type', id: 1111, user: $user); // maybe this cause linter errors\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateodioev%2Ftelegram-bot-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmateodioev%2Ftelegram-bot-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateodioev%2Ftelegram-bot-api/lists"}