PHP code example of middlewares / lowercase

1. Go to this page and download the library: Download middlewares/lowercase library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

middlewares / lowercase example snippets


$dispatcher = new Dispatcher([
    (new Middlewares\Lowercase())
        ->redirect()
        ->attribute('before-lowercase-uri')
]);

$response = $dispatcher->dispatch(new ServerRequest());

$responseFactory = new MyOwnResponseFactory();

//Simply set the path to lowercase
$lowercase = new Middlewares\Lowercase();

//Returns a redirect response to the new path
$lowercase = (new Middlewares\Lowercase())->redirect();

//Returns a redirect response to the new path using a specific response factory
$lowercase = (new Middlewares\Lowercase())->redirect($responseFactory);

// Save the original non-lowercase uri in the custom attribute "pre-lowercase-path"
$lowercase = (new Middlewares\Lowercase())->attribute('before-lowercase-uri');