PHPRouter\Router::setBasePath PHP Method

setBasePath() public method

Set the base _url - gets prepended to all route _url's.
public setBasePath ( $basePath )
$basePath
    public function setBasePath($basePath)
    {
        $this->basePath = rtrim($basePath, '/');
    }

Usage Example

 public function testMatchRouterUsingBasePath()
 {
     $collection = new RouteCollection();
     $collection->attach(new Route('/users/', array('_controller' => 'PHPRouter\\Test\\SomeController::usersCreate', 'methods' => 'GET')));
     $router = new Router($collection);
     $router->setBasePath('/localhost/webroot');
     foreach ($this->serverProvider() as $server) {
         $_SERVER = $server;
         self::assertTrue((bool) $router->matchCurrentRequest());
     }
 }
All Usage Examples Of PHPRouter\Router::setBasePath