Download the PHP package krak/mw-http without Composer

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

Http

The Krak Http package is a set of utilities for building Http applications. It comes with an implementation agnostic routing system, PSR-7 Response Factories, PSR-7 Server implementation, and a handful of useful middleware for Http applications.

Installation

Install via composer at krak/http

Usage

Response Factories

Every response factory must implement that interface.

Routes

Compiling Routes

Once you've created a set of routes, you can then compile them with a route compiler. These will traverse the hierarchy of routes and flatten them into an iterator with normalized paths.

Dispatch

To dispatch a set of routes, you need to create dispatcher factory, which will create a dispatcher from a set of routes, then you can dispatch a PSR-7 request.

Server

The server is responsible for creating a request, and emitting a response. It's a simple interface:

Middleware

Here are several useful middleware to use within your own applications. Each middleware takes two arguments: A PSR-7 Server Request, and an HttpLink. If you want more documentation on how the Link's work, checkout the Krak\Mw library.

injectRequestAttribute($name, $value)

This will automatically inject an attribute with a name and the given value.

wrap($psr7_middleware)

This will wrap PSR-7 style middleware that use the request and response in the middleware parameters.

serveStatic($root)

This will sit and will check if a file exists at the URI path. If it does, it will serve the file, else it will fall through to the next middleware.

mount($path, $mw)

Mounts a middleware on a path prefix. If the path prefix is matched, then the middleware is invoked.

The above middleware will try to load files on the /assets uri. So GET /assets/app.css will return a css file content if __DIR__ . /path/to/assets/app.css exists in the filesystem.

Tests and Examples

Run tests via:


All versions of mw-http with dependencies

PHP Build Version
Package Version
Requires evenement/evenement Version ^2.0
krak/mw Version ^0.5.0
nikic/fast-route Version ^1.0
nikic/iter Version ^1.4
pimple/pimple Version ^3.0
zendframework/zend-diactoros Version ^1.3
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 krak/mw-http contains the following files

Loading the files please wait ....