Overview
  • Namespace
  • Class

Namespaces

  • Slim
    • Exception
    • Handlers
      • Strategies
    • Http
    • Interfaces
      • Http

Interfaces

  • CallableResolverInterface
  • CollectionInterface
  • InvocationStrategyInterface
  • RouteGroupInterface
  • RouteInterface
  • RouterInterface

Interface RouterInterface

Router Interface

Direct known implementers

Slim\Router

Namespace: Slim\Interfaces
Package: Slim
Since: 3.0.0
Located at Interfaces/RouterInterface.php

Methods summary

public Slim\Interfaces\RouteInterface
# map( string[] $methods, string $pattern, callable $handler )

Add route

Add route

Parameters

$methods
Array of HTTP methods
$pattern
The route pattern
$handler
The route callable

Returns

Slim\Interfaces\RouteInterface
public array
# dispatch( Psr\Http\Message\ServerRequestInterface $request )

Dispatch router for HTTP request

Dispatch router for HTTP request

Parameters

$request
The current HTTP request object

Returns

array

Link

https://github.com/nikic/FastRoute/blob/master/src/Dispatcher.php
public Slim\Interfaces\RouteGroupInterface
# pushGroup( string $pattern, callable $callable )

Add a route group to the array

Add a route group to the array

Parameters

$pattern
The group pattern
$callable
A group callable

Returns

Slim\Interfaces\RouteGroupInterface
public boolean
# popGroup( )

Removes the last route group from the array

Removes the last route group from the array

Returns

boolean
True if successful, else False
public Slim\Interfaces\RouteInterface
# getNamedRoute( string $name )

Get named route object

Get named route object

Parameters

$name
Route name

Returns

Slim\Interfaces\RouteInterface

Throws

RuntimeException
If named route does not exist
public Slim\Interfaces\RouteInterface
# lookupRoute( $identifier )

Parameters

$identifier

Returns

Slim\Interfaces\RouteInterface
public string
# relativePathFor( string $name, array $data = [], array $queryParams = [] )

Build the path for a named route excluding the base path

Build the path for a named route excluding the base path

Parameters

$name
Route name
$data
Named argument replacement data
$queryParams
Optional query string parameters

Returns

string

Throws

RuntimeException
If named route does not exist
InvalidArgumentException
If required data not provided
public string
# pathFor( string $name, array $data = [], array $queryParams = [] )

Build the path for a named route including the base path

Build the path for a named route including the base path

Parameters

$name
Route name
$data
Named argument replacement data
$queryParams
Optional query string parameters

Returns

string

Throws

RuntimeException
If named route does not exist
InvalidArgumentException
If required data not provided

Constants summary

integer DISPATCH_STATUS
# 0
integer ALLOWED_METHODS
# 1
API documentation generated by ApiGen