2017 © Pedro Peláez
 

library request-parser

A library to parse raw HTTP requests for PHP CLI web servers and more.

image

sekjun9878/request-parser

A library to parse raw HTTP requests for PHP CLI web servers and more.

  • Wednesday, January 21, 2015
  • by sekjun9878
  • Repository
  • 1 Watchers
  • 2 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 33 % Grown

The README.md

RequestParser Build Status

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

RequestParser is a PHP library for parsing raw HTTP requests., (*2)

This library is not a complete to-specification implementation of the HTTP/1.1 protocol (because doing that would be extremely difficult and unnecessary), but implements most of the spec and should be good enough for the purposes of a specific-purpose HTTP server such as an API server for a PHP CLI application., (*3)

If in doubt, try it and see if it works for your purpose! But don't come knocking on my door if you accidentally manage to blow up your back yard... somehow., (*4)

Features

  • Easy to use
  • Unit tested
  • Comes in both Composer and PHAR versions
  • Supports Transfer-Encoding: Chunked
  • Batteries included!
    • We provide examples for you to copy paste and,
    • We return a default Request object for you to use instantly

Examples

Here is a quick example to demonstrate how easy it is to instantly get started:, (*5)

$requestParser = new RequestParser;
$requestParser->addData("GET /democracy/init HTTP/1.1\r\nUser-Agent: The Illuminati/2.0\r\nContent-Length: 10\r\n\r\nOver 9000!");

$request = Request::create($requestParser->exportRequestState());

var_dump($request->getHeaders());
var_dump($request->getPOST());

You can find more examples in the examples/ folder. The library is simple enough to use straight away without a documentation, but one is coming soon hopefully., (*6)

Installation

Composer

request-parser is PSR-4 compliant and can be installed using Composer. Simply add sekjun9878/request-parser to your composer.json file. Composer is the sane alternative to PEAR. It is excellent for managing dependencies in larger projects., (*7)

{
    "require": {
        "sekjun9878/request-parser": "~1.0"
    }
}

or, (*8)

php composer.phar require sekjun9878/request-parser ~1.0

PHAR

A PHP Archive (or .phar) file is available for downloading. Simply download the .phar, drop it into your project, and include it like you would any other php file. This method is ideal for smaller projects, one off scripts, and quick API hacking., (*9)

require_once(__DIR__."/request-parser.phar");

Downloads

For installation, see the installation notes above., (*10)

Download latest stable request-parser.phar here. Download latest master request-parser.phar here., (*11)

Additional links:, (*12)

API to return the URL to download the latest master build from: https://www.michael.yoo.id.au/projects/request-parser/api/latest-build-url.php, (*13)

License

Copyright (c) 2014 Michael Yoo <michael@yoo.id.au>
Released under the MIT license; see LICENSE
https://github.com/sekjun9878/request-parser

This project contains portions of source code from other projects; see LICENSE.

The Versions

21/01 2015

dev-master

9999999-dev https://github.com/sekjun9878/request-parser

A library to parse raw HTTP requests for PHP CLI web servers and more.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

http request parse

21/01 2015

v1.0.1

1.0.1.0 https://github.com/sekjun9878/request-parser

A library to parse raw HTTP requests for PHP CLI web servers and more.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

http request parse

20/01 2015

v1.0.0

1.0.0.0 https://github.com/sekjun9878/request-parser

A library to parse raw HTTP requests for PHP CLI web servers and more.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

http request parse