PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Payam Naderi   HTTP Abstraction   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: HTTP Abstraction
Parse HTTP requests and parse responses with PSR-7
Author: By
Last change: fix render headers value with CLRF
Date: 6 years ago
Size: 600 bytes
 

Contents

Class file image Download

HttpRequest

Build Http Request From Builder

Builder Support String or Array Settings.

$reqStr =<<< DOC
GET /api/v1.1/page/search HTTP/1.1
Host: site.com
Cache-Control: no-cache
DOC;

$request = new \Poirot\Http\HttpRequest(
    new BuildHttpRequest(BuildHttpRequest::parseWith($reqStr))
);

Headers

HeaderFactory::of('WWW-Authenticate: Basic realm="admin_panel"');
HeaderFactory::of(['WWW-Authenticate', 'Basic realm="admin_panel"']);
// options of specific header as plugin
HeaderFactory::of('WWW-Authenticate' => ['header_line' => 'Basic realm="admin_panel"']);