{"id":15136866,"url":"https://github.com/stk2k/net-driver","last_synced_at":"2026-01-19T18:02:59.018Z","repository":{"id":50947880,"uuid":"134096067","full_name":"stk2k/net-driver","owner":"stk2k","description":"HTTP client with plug-in system","archived":false,"fork":false,"pushed_at":"2021-05-27T02:03:25.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-16T05:27:46.055Z","etag":null,"topics":["curl","http-client","pluggable"],"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/stk2k.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":"2018-05-19T20:32:05.000Z","updated_at":"2021-05-27T02:03:27.000Z","dependencies_parsed_at":"2022-08-28T14:22:04.183Z","dependency_job_id":null,"html_url":"https://github.com/stk2k/net-driver","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/stk2k/net-driver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stk2k%2Fnet-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stk2k%2Fnet-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stk2k%2Fnet-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stk2k%2Fnet-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stk2k","download_url":"https://codeload.github.com/stk2k/net-driver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stk2k%2Fnet-driver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28578952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T17:42:58.221Z","status":"ssl_error","status_checked_at":"2026-01-19T17:40:54.158Z","response_time":67,"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":["curl","http-client","pluggable"],"created_at":"2024-09-26T06:41:38.811Z","updated_at":"2026-01-19T18:02:59.002Z","avatar_url":"https://github.com/stk2k.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"NetDriver, HTTP client with plug-in system\n=======================\n\n## Description\n\nNetDriver is a PHP library which provides sending HTTP requests.\n\n## Feature\n\n- Pluggable. You can easily replace other HTTP access library if you want.\n- Simple interfaces.\n- Callback events. You can customize your request before it is exectuted. Also you can get detail logs in sending request.\n- PSR-3 Logger acceptable.\n- cURL/PHP(file_get_contents) net drivers are bundled.\n\n## Usage\n\n1. Create net driver object(CurlNetDriver or PhpNetDriver are available).\n1. Create handle from net driver object.\n1. Create request object(HttpGetRequst/HttpPostRequest/JsonPostRequest are available).\n1. Call sendRequest method of net driver object and receive response object.\n\n## Demo\n\n### Example 1: sending HTTP request by cURL\n\n```php\nuse Stk2k\\NetDriver\\Drivers\\Curl\\CurlNetDriver;\n\n$driver = new CurlNetDriver();\n$request = new HttpGetRequest($driver, 'http://sazysoft.com/test/');\n$handle = $driver-\u003enewHandle();\n\ntry{\n    $response = $driver-\u003esendRequest($handle, $request);\n    echo $response-\u003egetBody();\n}\ncatch(NetDriverException $e)\n{\n    // error handling here\n}\n```\n\n### Example 2: sending HTTP request by file_get_contents\n\n```php\nuse Stk2k\\NetDriver\\Drivers\\Php\\PhpNetDriver;\n\n$driver = new PhpNetDriver();\n$request = new HttpGetRequest($driver, 'http://sazysoft.com/test/');\n$handle = $driver-\u003enewHandle();\n\ntry{\n    $response = $driver-\u003esendRequest($handle, $request);\n    echo $response-\u003egetBody();\n}\ncatch(NetDriverExceptionInterface $e)\n{\n    // error handling here\n}\n```\n\n### Example 3: post request\n\n```php\n$driver = new CurlNetDriver();\n$request = new HttpPostRequest($driver, 'http://sazysoft.com/test/', ['foo' =\u003e 'bar', 'baz' =\u003e 'qux']);\n$handle = $driver-\u003enewHandle();\n\ntry{\n    $response = $driver-\u003esendRequest($handle, $request);\n    echo $response-\u003egetBody();\n}\ncatch(NetDriverExceptionInterface $e)\n{\n    // error handling here\n}\n```\n\n### Example 4: request callback\n\n```php\n$driver = new CurlNetDriver();\n$request = new HttpGetRequest($driver, 'http://sazysoft.com/test/');\n$handle = $driver-\u003enewHandle();\n\ntry{\n    $driver-\u003elisten('request', function(HttpRequest $request){\n        $request-\u003eaddHttpHeader('Content-Type', 'text/json');       // set content type to text/json\n        return $request;    // replace old request to new one\n    });\n    $response = $driver-\u003esendRequest($handle, $request);\n    echo $response-\u003egetBody();\n}\ncatch(NetDriverExceptionInterface $e)\n{\n    // error handling here\n}\n```\n\n### Example 5: verbose callback\n\n```php\n$driver = new CurlNetDriver();\n$request = new HttpGetRequest($driver, 'http://sazysoft.com/test/');\n$handle = $driver-\u003enewHandle();\n\ntry{\n    $driver-\u003esetVerbose(true);          // curl netdriver can write debug info to output\n    $driver-\u003elisten('verbose', function($strerr, $header, $output){\n        echo '----[ strerr ]----' . PHP_EOL;\n        echo $strerr . PHP_EOL;\n        echo '----[ header ]----' . PHP_EOL;\n        echo $header . PHP_EOL;\n        echo '----[ output ]----' . PHP_EOL;\n        echo $output . PHP_EOL;\n    });\n    $response = $driver-\u003esendRequest($handle, $request);\n    echo '----[ response ]----' . PHP_EOL;\n    echo $response-\u003egetBody();\n}\ncatch(NetDriverExceptionInterface $e)\n{\n    // error handling here\n}\n```\n\n## Requirement\n\nPHP 7.1 or later\n\n\n## Installing NetDriver\n\nThe recommended way to install NetDriver is through\n[Composer](http://getcomposer.org).\n\n```bash\ncomposer require stk2k/net-driver\n```\n\nAfter installing, you need to require Composer's autoloader:\n\n```php\nrequire 'vendor/autoload.php';\n```\n\n## License\n[MIT](https://github.com/stk2k/net-driver/blob/master/LICENSE)\n\n## Author\n\n[stk2k](https://github.com/stk2k)\n\n## Disclaimer\n\nThis software is no warranty.\n\nWe are not responsible for any results caused by the use of this software.\n\nPlease use the responsibility of the your self.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstk2k%2Fnet-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstk2k%2Fnet-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstk2k%2Fnet-driver/lists"}