Download the PHP package phpraptor/request without Composer

On this page you can find all versions of the php package phpraptor/request. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package request

Build Status Code Climate Scrutinizer Code Quality

Introduction

Raptor Request is a light weight PHP library built using the SOLID principles to wrap the incoming HTTP request in one single object, with a structure based on [RFC7230].

To install the library , just run the following composer command.

To capture the request, simply create an object of the Http class.

As stated in Section 3 of the [RFC7230],

All HTTP/1.1 messages consist of a start-line followed by a sequence of octets in a format similar to the Internet Message Format [RFC5322]: zero or more header fields (collectively referred to as the "headers" or the "header section"), an empty line indicating the end of the header section, and an optional message body.

HTTP-message = start-line *( header-field CRLF ) CRLF [ message-body ]

Or, in simple words, a request message has three components, a request-line (according to Section 3.1 of the [RFC7230], for a request message the start-line will be a request-line), followed by header-fields and then a message-body.

You can access these three components by calling line(), header() and body() methods on the request object.

Request-line

Section 3.1.1 of the [RFC7230] states,

A request-line begins with a method token, followed by a single space (SP), the request-target, another single space (SP), the protocol version, and ends with CRLF.

request-line = method SP request-target SP HTTP-version CRLF

This means that the request-line itself is further divided into three sub-components.

Method token

To get the method token or the request method, call the method() function.

Request-target

Section 5.3 of the [RFC7230] states,

There are four distinct formats for the request-target, depending on both the method being requested and whether the request is to a proxy.

request-target = origin-form / absolute-form / authority-form / asterisk-form

According to Section 3.1.1 of the [RFC7230],

The most common form of request-target is the origin-form.

origin-form = absolute-path [ "?" query ]

The origin-form has two sub-components, the absolute-path and the query string parameters.

If you want to get a particular query string parameter, call the query() method and pass the required key as the argument.

You can also define a default value to return if a key does not exist in the query string parameters.

HTTP-version

To get the HTTP-version, call the version() method.

Header Fields

To get all the header fields or the request headers, call the all() method on the header() method of the request object.

If you want to get a particular header field, call the get() method and pass the required key as the argument.

You can also define a default value to return if a key does not exist in the header fields.

Cookies ($_COOKIE)

The browser cookies are sent to the server with the header fields, so to get all the cookies, call the cookie() method on the header() method of the request object.

If you want to get a particular cookie, call the cookie() method and pass the required key as the argument.

You can also define a default value to return if a key does not exist in the cookies.

Message Body

Section 3.3 of the [RFC7230] states,

The message body (if any) of an HTTP message is used to carry the payload body of that request

The payload body can contain request body parameters, i.e. $_POST, and any uploaded files, i.e. $_FILES.

Request Body Parameters ($_POST)

To get all the request body parameters, call the param() method.

If you want get a particular request body parameter, call the param() method and pass the required key as the argument.

You can also define a default value to return if a key does not exist in the request body parameters.

Uploaded Files ($_FILE)

To get all the uploaded files, call the files() method.

If you want get a particular uploaded file, call the file() method and pass the required key as the argument.

Content Length

To get the content length of the message body, call the contentLength() method.

Content Type

To get the content type of the message body, call the contentType() method.


All versions of request with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phpraptor/request contains the following files

Loading the files please wait ....