Download the PHP package samsonasik/expressive-redirect-handler without Composer
On this page you can find all versions of the php package samsonasik/expressive-redirect-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download samsonasik/expressive-redirect-handler
More information about samsonasik/expressive-redirect-handler
Files in samsonasik/expressive-redirect-handler
Package expressive-redirect-handler
Short Description Expressive middleware for URL Redirect handling
License MIT
Homepage https://github.com/samsonasik/ExpressiveRedirectHandler
Informations about the package expressive-redirect-handler
ExpressiveRedirectHandler
This is README for version ^2.0 which only support Mezzio version 3 with php ^7.1.
For version ^1.0, , you can read at version 1.* readme which support ZF Expressive version 3 with php ^7.1.
For version 0., you can read at [version 0. readme](https://github.com/samsonasik/ExpressiveRedirectHandler/tree/0.x.x) which still ZF Expressive version 1 and 2 with php ^5.6|^7.0 support.
ExpressiveRedirectHandler is a package that contains Mezzio middleware for handling redirect that fit with mezzio-skeleton for following conditions:
-
When the given url to
RedirectResponse
is not registered in routing config
For example, we use RedirectResponse
instance in our Middleware:
if the passed $redirect
as url is a valid and registered in the routes, it uses default RedirectResponse
implementation, otherwise, it will redirect to default default_url
registered in config/autoload/expressive-redirect-handler.local.php
:
For example, we define:
It means, we can't allow to make redirect to outside registered routes, whenever found un-registered url in routes, then we will be redirected to default_url. It also disable redirect to self, so you can't redirect to self.
For specific urls that exceptional ( allowed to be redirected even not registered in routes), you can register at exclude_urls
/exclude_hosts
options.
if you define exclude_urls/exclude_hosts options, which one of them is your own current url/host/domain, its your risk to still get "infinite" redirection loops. so, make sure exclude_urls/exclude_hosts is not your current own.
-
When you want to redirect to specific url based on header status code
Based on the configuration above, when header status code is 401 or 503, it will be redirected to its paired value.
Installation
-
Require via composer
-
Copy
vendor/samsonasik/expressive-redirect-handler/config/expressive-redirect-handler.local.php.dist
toconfig/autoload/expressive-redirect-handler.local.php
and modify on our needs. - Open
config/pipeline.php
and add:
at the very first pipeline records.
Contributing
Contributions are very welcome. Please read CONTRIBUTING.md
Credit
All versions of expressive-redirect-handler with dependencies
jeremykendall/php-domain-parser Version ^5.0
laminas/laminas-diactoros Version ^1.7.1