t0mmy742/trailing-slash-middleware


A PSR-15 middleware to remove trailing slash in URI

License: MIT

Language: PHP


Trailing Slash Middleware (PSR-15)

Build Status Coverage Status

This middleware remove trailing slash from URI. It implements PSR-15 MiddlewareInterface and need a PSR-17 ResponseFactory to work.

Installation

$ composer require t0mmy742/trailing-slash-middleware

Usage

<?php

use t0mmy742\Middleware\TrailingSlashMiddleware;

$responseFactory = new \Your\PSR17\ResponseFactory();
$middleware = new TrailingSlashMiddleware($responseFactory);

If path does not contain trailing slash, or if it is home ('/'), it does nothing. Otherwise, if it is a GET request, it creates a new Response with a 301 Permanent Redirect to the new URI (if not post, just handle request with new URI).

Project Statistics

Sourcerank 3
Repository Size 0 Bytes
Stars 0
Forks 0
Watchers 1
Open issues 0
Dependencies 7
Contributors 1
Tags 3
Created
Last updated
Last pushed

Top Contributors See all

Thomas LE BERRE

Packages Referencing this Repo

t0mmy742/trailing-slash-middleware
A PSR-15 middleware to remove trailing slash in URI
Latest release 1.0.2 - Updated

Recent Tags See all

1.0.2 September 12, 2019
1.0.1 September 12, 2019
1.0.0 September 12, 2019

Something wrong with this page? Make a suggestion

Last synced: 2019-09-14 07:17:09 UTC

Login to resync this repository