2017 © Pedro Peláez
 

library http

some useful http message library of the php

image

inhere/http

some useful http message library of the php

  • Sunday, June 10, 2018
  • by inhere
  • Repository
  • 2 Watchers
  • 3 Stars
  • 75 Installations
  • PHP
  • 9 Dependents
  • 2 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 9 % Grown

The README.md

http message

License Php Version Latest Stable Version, (*1)

http message 库,实现自 PSR 7。, (*2)

安装

  • 通过 composer.json

编辑 composer.json,在 require 添加, (*3)

"php-comp/http-message": "dev-master",

保存,然后执行: composer update, (*4)

  • 通过 composer require
composer require php-comp/http-message
  • git拉取
git clone https://github.com/php-comp/http-message.git // github

使用

基本使用

use PhpComp\Http\Message\Request;
use PhpComp\Http\Message\Response;

$request = new Request($method, $uri);
$request = new ServerRequest(... ...);
$response = new Response($code);
... ...

工厂方法

使用提供的工厂方法可以快速创建想要的实例对象。, (*5)

use PhpComp\Http\Message\HttpFactory;

$request = HttpFactory::createRequest($method, $uri);

// server request
$request = HttpFactory::createServerRequest('GET', 'http://www.abc.com/home');
$request = HttpFactory::createServerRequestFromArray($_SERVER);

$response = HttpFactory::createResponse($code);

扩展

use PhpComp\Http\Message\Request;
use PhpComp\Http\Message\Traits\ExtendedRequestTrait;

class MyRequest extends Request {
   use ExtendedRequestTrait; // 里面提供的更多方便使用的方法
}

// 

$request = new MyRequest(...);

$age = $request->getInt('age');
$name = $request->getTrimmed('name');
use PhpComp\Http\Message\Response;
use PhpComp\Http\Message\Traits\ExtendedResponseTrait;

class MyResponse extends Response {
   use ExtendedResponseTrait;
}

项目地址

  • github https://github.com/php-comp/http-message
  • git@osc https://gitee.com/php-comp/http-message

License

MIT, (*6)

The Versions

10/06 2018

dev-master

9999999-dev https://github.com/inhere/php-http

some useful http message library of the php

  Sources   Download

MIT

The Requires

 

curl library http tool

10/06 2018

v1.2.5

1.2.5.0 https://github.com/inhere/php-http

some useful http message library of the php

  Sources   Download

MIT

The Requires

 

curl library http tool

27/05 2018

v1.2.4

1.2.4.0 https://github.com/inhere/php-http

some useful http message library of the php

  Sources   Download

MIT

The Requires

 

curl library http tool

27/05 2018

dev-inhere-patch-1

dev-inhere-patch-1 https://github.com/inhere/php-http

some useful http message library of the php

  Sources   Download

MIT

The Requires

 

curl library http tool

29/03 2018

v1.2.3

1.2.3.0 https://github.com/inhere/php-http

some useful http message library of the php

  Sources   Download

MIT

The Requires

 

curl library http tool

28/03 2018

v1.2.2

1.2.2.0 https://github.com/inhere/php-http

some useful http message library of the php

  Sources   Download

MIT

The Requires

 

curl library http tool

09/02 2018

v1.2.1

1.2.1.0 https://github.com/inhere/php-http

some useful http message library of the php

  Sources   Download

MIT

The Requires

 

curl library http tool

21/10 2017

v1.2.0

1.2.0.0 https://github.com/inhere/php-http

some useful http message library of the php

  Sources   Download

MIT

The Requires

 

curl library http tool

20/10 2017

v1.1.1

1.1.1.0 https://github.com/inhere/php-http

some useful http message library of the php

  Sources   Download

MIT

The Requires

 

curl library http tool

20/10 2017

v1.1.0

1.1.0.0 https://github.com/inhere/php-http

some useful http message library of the php

  Sources   Download

MIT

The Requires

 

curl library http tool

11/09 2017

v1.0.0

1.0.0.0 https://github.com/inhere/php-http

some useful http message library of the php

  Sources   Download

MIT

The Requires

 

curl library http tool