Download the PHP package icanboogie/http without Composer

On this page you can find all versions of the php package icanboogie/http. 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 http

HTTP

Release Code Coverage Packagist

The icanboogie/http package provides a foundation to handle HTTP requests, with representations for requests, request files, responses, and headers. The package also lay the foundation of

The following example is an overview of request processing:

Installation

Request

A request is represented by a Request instance. The initial request is usually created from the $_SERVER array, while sub requests are created from arrays of Request::OPTION_* or RequestOptions::OPTION_* options.

Safe and idempotent requests

Safe methods are HTTP methods that don't modify resources. For instance, using GET or HEAD on a resource URL, should NEVER change the resource.

The is_safe property may be used to check if a request is safe or not.

An idempotent HTTP method is an HTTP method that can be called many times without different outcomes. It would not matter if the method is called only once, or ten times over. The result should be the same.

The is_idempotent property may be used to check if a request is idempotent or not.

A request with changed properties

Requests are for the most part immutable, the with() method creates an instance copy with changed properties.

Request parameters

Whether they're sent as part of the query string, the POST body, or the path info, parameters sent along a request are collected in arrays. The query_params, request_params, and path_params properties give you access to these parameters.

You can access each type of parameter as follows:

All the request parameters are also available through the params property, which merges the query, request and path parameters:

Used as an array, the Request instance provides these parameters as well, but returns null when a parameter is not defined:

Of course, the request is also an iterator:

Request files

Files associated with a request are collected in a FileList instance. The initial request created with $_SERVER obtain its files from $_FILES. For custom requests, files are defined using OPTION_FILES.

File represents uploaded files, and pretend uploaded files, with a single API. The is_uploaded property helps you set them apart.

The is_valid property is a simple way to check if a file is valid. The move() method lets you move the file out of the temporary folder or around the filesystem.

The match() method is used to check if a file matches a MIME type, a MIME class, or a file extension:

The method also handles sets, and returns true if there is any match:

File instances can be converted into arrays with the to_array() method:

Request context

Because requests may be nested, the request context offers a safe place where you can store the state of your application that is relative to a request. For instance, the context can store the relative site, page, route, dispatcher…

The following example demonstrates how to store a value in a request context:

Obtaining a response

A response is the result of a Responder's respond() method. An exception is thrown when a response can't be provided; for example, NotFound.

Response

The response to a request is represented by a Response instance. The response body can either be null, a string (or Stringable), or a Closure.

Note: Contrary to Response instances or completely mutable.

The header and body are sent by invoking the response:

Response status

The response status is represented by a Status instance. It may be defined as an HTTP response code such as 200, an array such as [ 200, "Ok" ], or a string such as "200 Ok".

Streaming the response body

When a large response body needs to be streamed, it is recommended to use a closure as a response body instead of a huge string that would consume a lot of memory.

About the Content-Length header field

Before v2.3.2 the Content-Length header field was added automatically when it was computable, for instance when the body was a string or an instance implementing __toString(). Starting v2.3.2, this is no longer the case, and the header field has to be defined when required. This was decided to prevent a bug with Apache+FastCGI+DEFLATE where the Content-Length field wasn't adjusted although the body was compressed. Also, in most cases it is not such a good idea to define that field for generated content because it prevents the response from being sent as compressed chunks.

Redirect response

A redirect response may be created using a RedirectResponse instance.

Delivering a file

A file may be delivered using a FileResponse instance. Cache control and range requests are handled automatically; you only have to provide the pathname of the file, or a SplFileInfo instance, and a request.

The OPTION_FILENAME option may be used to force downloading. Of course, utf-8 strings are supported:

The following options are also available:

The following properties are available:

Headers

Here is an overview of header usage. Details are available in the Headers documentation.

Exceptions

The HTTP package defines the following exceptions:

Exceptions defined by the package implement the ICanBoogie\HTTP\Exception interface. Using this interface, one can easily catch HTTP-related exceptions:


Continuous Integration

The project is continuously tested by GitHub actions.

Test Static Analysis Code Style

Code of Conduct

This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you're expected to uphold this code.

Contributing

See CONTRIBUTING for details.

License

icanboogie/http is released under the BSD-3-Clause.


All versions of http with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-mbstring Version *
icanboogie/prototype Version ^5.0
icanboogie/event Version ^4.0
icanboogie/datetime Version ^1.2
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 icanboogie/http contains the following files

Loading the files please wait ....