Download the PHP package simplemehanizm/http without Composer

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

Introduction

simplemehanizm/http is object-oriented wrapper around handling an HTTP request in PHP.

Purpose of the library is to be small in footprint, to enumerate status codes and reason phrases in order to help developers avoid using magic strings.

Where and when to use this

Use case is for projects, experiments and otherwise simple coding exercises in which author(s) want to avoid using heavy libraries like Symfony's HttpFoundation in order to gain access to object-oriented interface for an HTTP request.

The intent is not to replace or to provide an alternative to existing libraries that are doing the job well.

Installation

composer require simplemehanizm/http

Usage

Create Request instance using PHP's superglobal variables

Create request instance by specifying input values

Accessing headers

Accessing input

The Request::input method uses PHP's superglobal $_REQUEST to read the data. For POST or GET values, use post() or get() functions.

Accessing GET values

Uses PHP's $_GET to access values

Accessing POST values

What if HTTP body was valid JSON?

If your request contains valid JSON, the Request class will json_decode the body IF it finds the Content-Type: application/json HTTP header

The resulting JSON input will be merged to values found in $_REQUEST, allowing you to access them using $request->input() method.

What else is there?

The src/Protocol contains several enums that expose defined HTTP status codes, phrase values, headers and similar. Explore them :)


All versions of http with dependencies

PHP Build Version
Package Version
Requires simplemehanizm/array Version ^1.0
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 simplemehanizm/http contains the following files

Loading the files please wait ....