src/Url.php
public static function addBackSlash($uri, $position = 'end')
    {
        switch ($position) {
            case 'top':
                $uri = '/' . ltrim($uri, '/');
                break;
            case 'end':
                $uri = rtrim($uri, '/') . '/';
                break;
            case 'both':
                $uri = ! empty($uri) ? '/' . trim($uri, '/') . '/' : '';
                break;
            default:
                $uri = false;
        }

        return $uri;
    }
public static function addBackSlash($uri, $position = 'end')
    {
        switch ($position) {
            case 'top':
                $uri = '/' . ltrim($uri, '/');
                break;
            case 'end':
                $uri = rtrim($uri, '/') . '/';
                break;
            case 'both':
                $uri = ! empty($uri) ? '/' . trim($uri, '/') . '/' : '';
                break;
            default:
                $uri = false;
        }

        return $uri;
    }
public static function addBackSlash ( $ uri , $ position = 'end' ) { switch ( $ position ) { case 'top' : $ uri = '/' . ltrim ( $ uri , '/' ) ; break ; case 'end' : $ uri = rtrim ( $ uri , '/' ) . '/' ; break ; case 'both' : $ uri = ! empty ( $ uri ) ? '/' . trim ( $ uri , '/' ) . '/' : '' ; break ; default : $ uri = false ; } return $ uri ; }
Add backslash if it does not exist at the end of the route.

@param string $uri      → URI
@param string $position → place where the backslash is placed

@return string|false → path/url/ | /path/url | /path/url/
Add backslash if it does not exist at the end of the route .