src/Http/Middleware/BasePathStripper.php
public function process(ServerRequestInterface $request, RequestHandlerInterface $next) : ResponseInterface
    {
        $path = $request->getUri()->getPath();
        if (!empty($this->basePath) && 0 === strpos($path, $this->basePath)) {
            $cleanPath = substr($path, strlen($this->basePath));

            if ($cleanPath === false) {
                $cleanPath = '';
            }

            $request = $request->withUri($request->getUri()->withPath($cleanPath));
        }
        return $next->handle($request);
    }
public function process(ServerRequestInterface $request, RequestHandlerInterface $next) : ResponseInterface
    {
        $path = $request->getUri()->getPath();
        if (!empty($this->basePath) && 0 === strpos($path, $this->basePath)) {
            $cleanPath = substr($path, strlen($this->basePath));

            if ($cleanPath === false) {
                $cleanPath = '';
            }

            $request = $request->withUri($request->getUri()->withPath($cleanPath));
        }
        return $next->handle($request);
    }
public function process ( ServerRequestInterface $ request , RequestHandlerInterface $ next ) : ResponseInterface { $ path = $ request -> getUri ( ) -> getPath ( ) ; if ( ! empty ( $ this -> basePath ) && 0 === strpos ( $ path , $ this -> basePath ) ) { $ cleanPath = substr ( $ path , strlen ( $ this -> basePath ) ) ; if ( $ cleanPath === false ) { $ cleanPath = '' ; } $ request = $ request -> withUri ( $ request -> getUri ( ) -> withPath ( $ cleanPath ) ) ; } return $ next -> handle ( $ request ) ; }
strip away the basePath

@param ServerRequestInterface $request
@param RequestHandlerInterface $next
@return ResponseInterface
strip away the basePath