Download the PHP package phpdot/http-middleware without Composer

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

phpdot/http-middleware

PSR-15 middlewares for PHPdot. Each is a small, framework-agnostic middleware that plugs into any PSR-15 pipeline.

Class Does
Pipeline The PSR-15 dispatcher: runs a middleware list (outermost first) around a final handler. Itself a RequestHandlerInterface, so pipelines nest and any transport serves one directly. Stateless per call — one shared instance is coroutine-safe under Swoole.
JsonBodyMiddleware Decodes application/json request bodies into the request's parsed body; rejects malformed JSON with 400.
AjaxMiddleware Restricts a route to script-issued requests; a browser navigating to it gets a 404. A convenience, not a security control — the signals are client-supplied.

Table of Contents

Requirements

Requirement Constraint
PHP >= 8.5
phpdot/contracts ^0.5
psr/http-factory ^1.0
psr/http-message ^2.0
psr/http-server-handler ^1.0
psr/http-server-middleware ^1.0

Bring any PSR-7/PSR-17 implementation (for example phpdot/http).

Installation

Usage

Pipeline

Compose middlewares around a final handler; the pipeline is itself a PSR-15 handler:

Middlewares run in list order — the first is outermost. Each may short-circuit by returning a response without delegating; when every middleware delegates, the final handler runs. Pipelines nest: a Pipeline is a valid final handler for another Pipeline.

JsonBodyMiddleware

For requests with a application/json content type, it decodes the body and exposes it via getParsedBody(); a malformed body returns a 400 with a JSON error, and non-JSON or empty bodies pass straight through. Construct it with your PSR-17 response and stream factories and add it to the pipeline:

Testing

License

MIT.

This repository is a read-only mirror, generated by CI from phpdot/monorepo. Pull requests and issues belong in the monorepo.


All versions of http-middleware with dependencies

PHP Build Version
Package Version
Requires php Version >=8.5
phpdot/contracts Version ^0.5
psr/http-factory Version ^1.0
psr/http-message Version ^2.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware 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 phpdot/http-middleware contains the following files

Loading the files please wait ...