PHP code example of guidofaecke / blast-base-url

1. Go to this page and download the library: Download guidofaecke/blast-base-url 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/ */

    

guidofaecke / blast-base-url example snippets


// ...
$app->pipe(\Blast\BaseUrl\BaseUrlMiddleware::class);

// ...
$app->pipe(RouteMiddleware::class);

echo $request->getAttribute(BaseUrlMiddleware::BASE_URL);   
// outputs: /some/subdirectory/index.php

echo $request->getAttribute(BaseUrlMiddleware::BASE_PATH);
// outputs: /some/subdirectory/