Download the PHP package simplecomplex/http without Composer

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

High-level HTTP client and (Slim) service utility.
Client provides response validation and mocking.
Service provides standardized and predictable responses.

### ▹ Client ### #### Request options #### The method accepts it's own options as well as options for the underlying [RestMini Client](https://github.com/simplecomplex/restmini#client-options). ##### Own options ##### - (bool) **debug_dump**: log request and response - (bool|arr) **cacheable**: cache response/load response from [cache](https://github.com/simplecomplex/php-cache) - (bool|arr) **validate_response**: validate the response body against a [validation rule set](https://github.com/simplecomplex/php-validate) - (bool|arr) **mock_response**: don't send the request, return predefined mock response - (int) **retry_on_unavailable**: millisecs; try again later upon 503 Service Unavailable|host not found|connection failed - (arr) **require_response_headers**: list of response header keys required - (bool) **err_on_endpoint_not_found**: err on 404 + HTML response - (bool) **err_on_resource_not_found**: err on 204 or 404 + JSON response - (arr) **log_warning_on_status**: key is status code, value is true ##### Options processing ##### Apart from options passed directly to there may also exist settings (see [Config](https://github.com/simplecomplex/php-config)) for the: - **provider**: the service host - **service**: a group of endpoints - **endpoint**: the actual endpoint - **method**: literal HTTP method or an alias (like GET aliases index and retrieve) During request preparations settings and options get merged, so that – _options_ override _method_ settings, which override _endpoint_ settings, which override... (you get it). Sounds like a lot of work, but it isn't really.
#### ▹▹ Client CLI commands #### ##### (remote) Service configuration ##### ##### Validation rule sets ##### ##### Mock responses #####
#### ▹▹ Client error codes #### For every error code there's an equivalent prefab safe and user-friendly (localizable) error message. - : overall error fallback - : local error fallback - : in-package logical error - : invalid argument et al. - : bad config var - : bad option var - : RestMini Client or cURL cannot request - : DNS or actually no such host - : status 503 Service Unavailable - : too many redirects - : cURL 504 - : status 504 Gateway Timeout - : cURL 500 (RestMini Client 'response-false') - : status 500 Internal Server Error - : remote says 502 Bad Gateway - : unsupported 5xx status - : status 404 + Content-Type not JSON (probably HTML); no such endpoint - : status 204, status 404 + Content-Type JSON; no such resource (object) - : 400 Bad Request - : 412 Precondition Failed, 422 Unprocessable Entity - : content type mismatch - : parse error - : unsupported non-5xx status - : setting/option _require_response_headers_ - : response body validation failure; service will send X-Http-Response-Invalid header
### ▹ Service ### Producing a service response is not as hard as requesting a remote service, so the service part of **Http** is not as rich as the client part. It is assumed that one will simply echo something and send some headers – or use a service framework like [Slim](https://www.slimframework.com/). The class suggest means of interacting with Slim, and **Http** includes a simple example. @todo And **Http** also provides a few other service utilities. #### Allowing Cross Origin requests #### Preferably only at development site. Necessary when developing Angular-based frontend. Place a text file in document root, containing list allowed sites, like:
#### ▹▹ Service error codes #### For every error code there's an equivalent prefab safe and user-friendly (localizable) error message. - : overall fallback - : (some kind of) bad request; - : authentication (login) failure; - : authorization (permission) failure; - : request header/argument validation failure; - : frontend only; parse error - : frontend only; response validation failure

Service and client combined

Standardized wrapped response body

A service requestor should never be in doubt whether a request to your service went alltogether well.
returns object:

The general idea is to always send a response body containing metadata about the procedings – success, status, code.
And – on failure – a prefab safe and user-friendly message, which the client can use to inform the visitor
(instead of just failing silently/ungracefully).

When exposing a service that does a remote request, the service should however have access to more detailed info about the remote request/response
– therefore the further wrapping in an object that suggests status and headers (et al.).

#### ▹ Service response headers #### **Http** uses a number of custom response headers, to flag stuff to the client. Some are issued by upon every remote request (the original/final statuses). Others are only issued if a service uses/sends one of the prefab extensions. - (int): status received from remote service (or interpretated ditto) - (int): final status to be sent to client - : response validation failure; - : never called remote service; used prefab mock response - : request header/argument validation failure; - : (some kind of) bad request; - : authentication (login) failure; - : authorization (permission) failure;

Requirements

Suggestions


All versions of http with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
ext-ctype Version *
psr/log Version ^1.0
simplecomplex/utils Version ^1.9 || ^2.0 || dev-develop
simplecomplex/cache Version ^1.3 || dev-develop
simplecomplex/config Version ^2.1 || dev-develop
simplecomplex/locale Version ^2.1 || dev-develop
simplecomplex/validate Version ^2.1 || ^1.0 || dev-develop
simplecomplex/restmini Version ^1.1.2 || dev-develop
simplecomplex/inspect Version ^3 || ^2.2.5 || dev-develop
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 simplecomplex/http contains the following files

Loading the files please wait ....