Skip to content

Commit

Permalink
Adds HTTP Connection (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdijia authored Mar 24, 2023
1 parent 2816f91 commit c4eed24
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"require": {
"php": ">=8.0",
"hyperf/engine-contract": "~1.6.0"
"hyperf/engine-contract": "~1.7.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
Expand All @@ -51,7 +51,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.6-dev"
"dev-master": "2.7-dev"
},
"hyperf": {
"config": "Hyperf\\Engine\\ConfigProvider"
Expand Down
40 changes: 40 additions & 0 deletions src/Http/Connection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Engine\Http;

use Hyperf\Engine\Contract\Http\ConnectionInterface;
use Swoole\Http\Response;

class Connection implements ConnectionInterface
{
public function __construct(protected Response $response)
{
}

public function write(string $data): bool
{
return $this->response->write($data);
}

/**
* @return Response
*/
public function getSocket(): mixed
{
return $this->response;
}

public function end(?string $content = null): bool
{
return $this->response->end($content);
}
}

0 comments on commit c4eed24

Please sign in to comment.