2017 © Pedro Peláez
 

library http

Uniondrug Http Component for uniondrug/framework

image

uniondrug/http

Uniondrug Http Component for uniondrug/framework

  • Tuesday, April 3, 2018
  • by wsfuyibing
  • Repository
  • 3 Watchers
  • 0 Stars
  • 186 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 178 % Grown

The README.md

Uniondrug HTTP Server and Client

THANKS:本模块来自 FastD, (*1)

简单的 Http 协议组件, 用于解析 Http 请求信息, 实现 PSR-7 标准, 支持 Swoole 扩展., (*2)

以上库可以满足大部分 HTTP 请求处理相关工作, 支持 Swoole 处理, 具体请看项目Swoole。, (*3)

要求

  • php >= 5.6

安装

composer require "uniondrug/http" -vvv

文档

文档, (*4)

使用

HTTP 组件封装了常用的服务端解释,客户端请求,并且友好集成 Swoole Http Server 解析,实现PSR-7。, (*5)

获取 pathinfo
use Uniondrug\Http\ServerRequest;

$request = ServerRequest::createServerRequestFromGlobals();

$request->getUri()->getPath();
Swoole Http 服务器
$http = new swoole_http_server("127.0.0.1", 9501);

$http->on('request', function ($request, $response) {
    $server = SwooleServerRequest::createServerRequestFromSwoole($request);
    $response->end($server->getUri()->getPath());
});

$http->start();
cURL 请求

Request 对象内部封装了 cURL 请求, 可以直接通过方法调用, (*6)

$request = new Request('GET', 'https://api.github.com/');

$request->setReferrer('http://example.com/');

$response = $request->send(); // Uniondrug\Http\Response

响应内容会通过 Response 对象返回。, (*7)

License MIT

The Versions

03/04 2018

dev-master

9999999-dev

Uniondrug Http Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JanHuang
by Uniondrug Dev Team

psr http

03/04 2018

2.0.1

2.0.1.0

Uniondrug Http Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JanHuang
by Uniondrug Dev Team

psr http

29/03 2018

2.x-dev

2.9999999.9999999.9999999-dev

Uniondrug Http Component for uniondrug/framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JanHuang
by Uniondrug Dev Team

psr http

28/03 2018

2.0.0

2.0.0.0

Uniondrug Http Component

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JanHuang

psr http