Skip to content

Commit 94236f8

Browse files
committed
feat(http): introduce Http Client module and improve request/response handling
1 parent fd78ac3 commit 94236f8

18 files changed

Lines changed: 1944 additions & 79 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ ripple-kernel.iml
55
/debug/
66
/logs/
77
/vendor/
8+
*.md
89

910
composer.lock
1011

1112
.php-cs-fixer.cache
1213
.phpunit*
14+
!README.md

src/Net/Http.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace Ripple\Net;
1414

15+
use Ripple\Net\Http\Client;
1516
use Ripple\Net\Http\Server;
1617
use Ripple\Stream\Exception\ConnectionException;
1718
use Throwable;
@@ -33,4 +34,14 @@ public static function server(string $address, mixed $steamContext = null): Serv
3334
throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
3435
}
3536
}
37+
38+
/**
39+
* 创建 HTTP 客户端
40+
* @param array $config 客户端配置选项
41+
* @return Client
42+
*/
43+
public static function client(array $config = []): Client
44+
{
45+
return new Client($config);
46+
}
3647
}

0 commit comments

Comments
 (0)