Skip to content

snicco/redirect-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Middleware for snicco/http-routing to configure bulk redirects.

codecov Psalm Type-Coverage Psalm level PhpMetrics - Static Analysis PHP-Versions

This middleware for the snicco/http-routing component allows mass redirects based on configuration files.

Installation

composer require snicco/redirect-middleware

Usage

This middleware should be added globally in the MiddlewareResolver.

The Redirect middleware must be bound in the PSR-11 container that is used by the snicco/http-routing component.

// In your configuration for your PSR-11 container
use Snicco\Middleware\Redirect\Redirect;

$redirects = [
    307 => [
      '/foo' => '/bar'  
    ],
    301 =>  [
      '/baz' => 'biz?boom=bang'
      '/boom' => 'https://external-page.com'
    ]   
];

// You can also load the redirects from a file.
$redirect = new Redirect($redirects);

Contributing

This repository is a read-only split of the development repo of the Snicco project.

This is how you can contribute.

Reporting issues and sending pull requests

Please report issues in the Snicco monorepo.

Security

If you discover a security vulnerability, please follow our disclosure procedure.

About

[READ ONLY] Subtree split of the snicco/redirect-middleware package (see snicco/snicco).

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages