{"id":39779003,"url":"https://github.com/nullform/tgstat-client","last_synced_at":"2026-01-18T12:01:31.267Z","repository":{"id":57029261,"uuid":"226275281","full_name":"nullform/tgstat-client","owner":"nullform","description":"TGStat API client","archived":false,"fork":false,"pushed_at":"2023-10-30T11:05:27.000Z","size":93,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-15T01:55:50.091Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nullform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-12-06T07:54:06.000Z","updated_at":"2024-03-08T06:45:06.000Z","dependencies_parsed_at":"2022-08-23T17:40:48.768Z","dependency_job_id":"fa679760-ff47-4c32-abe6-89c846ca0e44","html_url":"https://github.com/nullform/tgstat-client","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":0.3157894736842105,"last_synced_commit":"5edc02cc4fad450fe972ba0d1a474db456c329c9"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/nullform/tgstat-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullform%2Ftgstat-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullform%2Ftgstat-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullform%2Ftgstat-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullform%2Ftgstat-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nullform","download_url":"https://codeload.github.com/nullform/tgstat-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullform%2Ftgstat-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28535273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-18T12:00:47.806Z","updated_at":"2026-01-18T12:01:31.189Z","avatar_url":"https://github.com/nullform.png","language":"PHP","readme":"# TGStat API client\n\nNon official PHP client for TGStat API (https://tgstat.ru).\n\nDocumentation for working with the Telegram Analytics API:\nhttps://api.tgstat.ru/docs/\n\n## Installation\n\n```\ncomposer require nullform/tgstat-client\n```\n\nYou can get your personal token here: https://api.tgstat.ru/docs/ru/start/token.html\n\n## Usage\n\n### Basic\n\n```php\nuse Nullform\\TGStatClient;\n\n$client = new TGStatClient\\Client($token);\n$client-\u003esandbox(true);\n$client-\u003etimeout(10);\n$client-\u003euserAgent('TGStatClient');\n\ntry {\n    // API request statistics\n    $usage_stat = $client-\u003ecallUsageStat();\n} catch (\\Exception $exception) {\n    $error = $exception-\u003egetMessage();\n}\n```\n\n### Usage statistics\n\n```php\n$usage_stat = $client-\u003ecallUsageStat();\n```\n\n### Search for posts\n\n```php\n$params = new TGStatClient\\Params\\PostsSearchParams();\n\n$params-\u003eq = 'Jazz | \"Jazz music\"'; // Extended syntax\n$params-\u003ehideDeleted = 1;\n$params-\u003epeerType = 'channel';\n$params-\u003eextended = 1;\n$params-\u003eextendedSyntax = 1;\n$params-\u003elimit = 3;\n\n$posts = $client-\u003ecallPostsSearch($params);\n```\n\n### Words mentions by channels\n\n```php\n$params = new TGStatClient\\Params\\WordsMentionsByChannelsParams();\n\n$params-\u003eq = 'Jazz music';\n$params-\u003estrongSearch = 1;\n\n$mentions = $client-\u003ecallWordsMentionsByChannels($params);\n```\n\n### Last request info\n\nYou can allways get last request instance by `Client::lastRequest()`.\n\n```php\n$request = $client-\u003elastRequest();\n```\n\n### Last response info\n\nYou can allways get last response instance by `Client::lastResponse()`.\n\n```php\n$status = $client-\u003elastResponse()-\u003estatus;\n$http_status = $client-\u003elastResponse()-\u003egetHttpStatus();\n$is_from_cache = $client-\u003elastResponse()-\u003efrom_cache;\n\nif ($client-\u003elastResponse()-\u003egetError()) {\n    $error = $client-\u003elastResponse()-\u003egetError()-\u003emessage;\n}\n```\n\n### Caching\n\nYou can cache API responses if you use PSR-6 or PSR-16 caching in your project.\nJust pass to `Client::caching()` your cache repository instance, TTL and prefix.\n\nIf the cache instance is passed, each successful response will be stored to the cache for the `$ttl` seconds.\nWith repeated requests with the same parameters, the response will be taken from the cache.\n\n```php\n// Set PSR-6 or PSR-16 cache instance, TTL (60) and cache keys prefix (tgstat_client_)\n$client-\u003ecaching($cache, 60, 'tgstat_client_');\n```\n\n### Logging\n\nYou can log your API calls by passing your own function to `Client::logFunction()`. Passed function will be called on every TGStat API call.\nThe function takes an instance of `\\Nullform\\TGStatClient\\Client` as a parameter.\nFor example:\n\n```php\n$log_func = function (TGStatClient\\Client $client) {\n    file_put_contents('tgstat-client-log.log', print_r($client-\u003elastResponse(), true));\n};\n\n$client = new TGStatClient\\Client($token);\n$client-\u003elogFunction($log_func);\n\n$stat = $client-\u003ecallUsageStat();\n```\n\nOr you can just override the `Client::log()` method that is called on every TGStat API call.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullform%2Ftgstat-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnullform%2Ftgstat-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullform%2Ftgstat-client/lists"}