Download the PHP package yiisoft/yii-middleware without Composer

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

Yii

Yii Middleware


Latest Stable Version Total Downloads Build status Code Coverage Mutation testing badge static analysis type-coverage psalm-level

The package provides middleware classes that implement PSR-15:

For proxy related middleware, there is a separate package - Yii Proxy Middleware.

For more information on how to use middleware in the Yii Framework, see the Yii middleware guide.

Requirements

Installation

The package could be installed with Composer:

General usage

All classes are separate implementations of PSR 15 middleware and don't interact with each other in any way.

ForceSecureConnection

Redirects insecure requests from HTTP to HTTPS, and adds headers necessary to enhance the security policy.

The Content-Security-Policy (CSP) header can force the browser to load page resources only through a secure connection, even if links in the page layout are specified with an unprotected protocol.

Middleware adds HTTP Strict-Transport-Security (HSTS) header to each response. The header tells the browser that your site works with HTTPS only.

HttpCache

Implements client-side caching by utilizing the Last-Modified and ETag HTTP headers.

Additionally, you can specify the following options:

IpFilter

IpFilter allows access from specified IP ranges only and responds with 403 for all other IPs.

Redirect

Generates and adds a Location header to the response.

You can also set the status of the response code for redirection.

Subfolder

Supports routing when the entry point of the application isn't directly at the webroot. By default, it determines webroot based on server parameters.

Info: You should place this middleware before Route middleware in the middleware list.

If you want the application to run on the specified path, use the prefix instead:

TagRequest

Tags request with a random value that could be later used for identifying it.

Locale

Supports locale-based routing and configures URL generator.

Info: You should place this middleware before Route middleware in the middleware list.

The priority of lookup is the following:

  1. URI query path, that's /de/blog.
  2. URI query parameter name, that's /blog?_language=de. You can customize parameter name via withQueryParameterName().
  3. Cookie named _language. You can customize name via withCookieName().
  4. Accept-Language header. Not enabled by default. Use withDetectLocale(true) to enable it.

Found locale is not saved by default. It can be saved to cookies:

To configure more services, such as translator or session, use SetLocaleEvent (Yii Event Dispatcher is required).

Note: Using tranlator requires Yii Message Translator.

CorsAllowAll

Adds CORS headers to the response.

Documentation

If you need help or have a question, the Yii Forum is a good place for that. You may also check out other Yii Community Resources.

License

The Yii Middleware is free software. It is released under the terms of the BSD License. Please see LICENSE for more information.

Maintained by Yii Software.

Support the project

Open Collective

Follow updates

Official website Twitter Telegram Facebook Slack


All versions of yii-middleware with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
psr/event-dispatcher Version ^1.0
psr/http-factory Version ^1.0
psr/log Version ^3.0
psr/http-message Version ^1.0|^2.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.0
yiisoft/aliases Version ^3.0
yiisoft/cookies Version ^1.2
yiisoft/friendly-exception Version ^1.0
yiisoft/http Version ^1.2
yiisoft/network-utilities Version ^1.2
yiisoft/router Version ^3.0
yiisoft/session Version ^2.0
yiisoft/strings Version ^2.1
yiisoft/validator Version ^1.0|^2.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 yiisoft/yii-middleware contains the following files

Loading the files please wait ....