{"id":36983049,"url":"https://github.com/matasarei/phptcp","last_synced_at":"2026-01-13T22:55:00.646Z","repository":{"id":51316253,"uuid":"365474403","full_name":"matasarei/phptcp","owner":"matasarei","description":"A TCP client for PHP","archived":false,"fork":false,"pushed_at":"2023-12-02T20:16:36.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-11T16:53:29.701Z","etag":null,"topics":["client","socket","tcp-client"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/matasarei/phptcp","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/matasarei.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}},"created_at":"2021-05-08T09:34:58.000Z","updated_at":"2022-04-13T20:22:37.000Z","dependencies_parsed_at":"2022-09-24T19:12:05.471Z","dependency_job_id":null,"html_url":"https://github.com/matasarei/phptcp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/matasarei/phptcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matasarei%2Fphptcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matasarei%2Fphptcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matasarei%2Fphptcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matasarei%2Fphptcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matasarei","download_url":"https://codeload.github.com/matasarei/phptcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matasarei%2Fphptcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28400961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: 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":["client","socket","tcp-client"],"created_at":"2026-01-13T22:55:00.569Z","updated_at":"2026-01-13T22:55:00.637Z","avatar_url":"https://github.com/matasarei.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP TCP\n![example workflow](https://github.com/matasarei/phptcp/actions/workflows/tests.yml/badge.svg)\n\nA TCP client for PHP. This is a demo library: it is provided as is, without any guarantees.\n\n## Basic usage\n```php\nuse Matasar\\PhpTcp\\Client;\nuse Matasar\\PhpTcp\\Request;\nuse Matasar\\PhpTcp\\Socket\\StreamSocket;\n\n$client = new Client('ip_or_hostname', 8888, new StreamSocket());\n$client-\u003econnect();\n\n$request = new Request('request');\n$response = $client-\u003erequest($request);\n$client-\u003edisconnect();\n\nvar_dump($response-\u003egetData());\n```\n\n## Socket interface\nThe lib includes two socket interfaces to use: `StreamSocket` and `FSocket`. \nThe difference is between using `stream_socket_client` and `fsockopen`. \nChoose one you need or like more or implement your own class.\n\nAlso, there is the blocking setting you can change:\n```php\nuse Matasar\\PhpTcp\\Socket\\FSocket;\n\nnew FSocket(0); // disable blocking.\n```\n\n## Client settings\n```php\nuse Matasar\\PhpTcp\\Client;\nuse Matasar\\PhpTcp\\Socket\\FSocket;\n\n$client = new Client('hostname', 1234, new FSocket());\n\n$client-\u003esetChunkSize(8192); // read data by 8 Kb per cycle.\n$client-\u003esetConnectionLag(5000); // 5 ms pause per cycle.\n$client-\u003esetLogger(new SomePsrLogger()); // connect a logger for debugging.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatasarei%2Fphptcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatasarei%2Fphptcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatasarei%2Fphptcp/lists"}