Overview
  • Namespace
  • Class

Namespaces

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

Classes

  • App
  • CallableResolver
  • Collection
  • Container
  • DefaultServicesProvider
  • DeferredCallable
  • Routable
  • Route
  • RouteGroup
  • Router

Traits

  • CallableResolverAwareTrait
  • MiddlewareAwareTrait

Class Route

Route

Slim\Routable uses Slim\CallableResolverAwareTrait
Extended by Slim\Route implements Slim\Interfaces\RouteInterface uses Slim\MiddlewareAwareTrait
Namespace: Slim
Located at Route.php

Methods summary

public
# __construct( string|string[] $methods, string $pattern, callable $callable, Slim\RouteGroup[] $groups = [], integer $identifier = 0 )

Create new route

Create new route

Parameters

$methods
The route HTTP methods
$pattern
The route pattern
$callable
The route callable
$groups
The parent route groups
$identifier
The route identifier
public
# finalize( )

Finalize the route in preparation for dispatching

Finalize the route in preparation for dispatching

public callable
# getCallable( )

Get route callable

Get route callable

Returns

callable
public
# setCallable( string|Closure $callable )

This method enables you to override the Route's callable

This method enables you to override the Route's callable

Parameters

$callable
public string[]
# getMethods( )

Get route methods

Get route methods

Returns

string[]
public Slim\RouteGroup[]
# getGroups( )

Get parent route groups

Get parent route groups

Returns

Slim\RouteGroup[]
public null|string
# getName( )

Get route name

Get route name

Returns

null|string

Implementation of

Slim\Interfaces\RouteInterface::getName()
public string
# getIdentifier( )

Get route identifier

Get route identifier

Returns

string
public boolean|string
# getOutputBuffering( )

Get output buffering mode

Get output buffering mode

Returns

boolean|string
public
# setOutputBuffering( boolean|string $mode )

Set output buffering mode

Set output buffering mode

One of: false, 'prepend' or 'append'

Parameters

$mode

Throws

InvalidArgumentException
If an unknown buffering mode is specified

Implementation of

Slim\Interfaces\RouteInterface::setOutputBuffering()
public Slim\Route
# setName( string $name )

Set route name

Set route name

Parameters

$name

Returns

Slim\Route

Throws

InvalidArgumentException
if the route name is not a string

Implementation of

Slim\Interfaces\RouteInterface::setName()
public Slim\Route
# setArgument( string $name, string $value )

Set a route argument

Set a route argument

Parameters

$name
$value

Returns

Slim\Route

Implementation of

Slim\Interfaces\RouteInterface::setArgument()
public Slim\Route
# setArguments( array $arguments )

Replace route arguments

Replace route arguments

Parameters

$arguments

Returns

Slim\Route

Implementation of

Slim\Interfaces\RouteInterface::setArguments()
public array
# getArguments( )

Retrieve route arguments

Retrieve route arguments

Returns

array

Implementation of

Slim\Interfaces\RouteInterface::getArguments()
public mixed
# getArgument( string $name, string|null $default = null )

Retrieve a specific route argument

Retrieve a specific route argument

Parameters

$name
$default

Returns

mixed

Implementation of

Slim\Interfaces\RouteInterface::getArgument()
public
# prepare( Psr\Http\Message\ServerRequestInterface $request, array $arguments )

Prepare the route for use

Prepare the route for use

Parameters

$request
$arguments

Implementation of

Slim\Interfaces\RouteInterface::prepare()
public Psr\Http\Message\ResponseInterface
# run( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response )

Run route

Run route

This method traverses the middleware stack, including the route's callable and captures the resultant HTTP response object. It then sends the response back to the Application.

Parameters

$request
$response

Returns

Psr\Http\Message\ResponseInterface

Implementation of

Slim\Interfaces\RouteInterface::run()
public Psr\Http\Message\ResponseInterface
# __invoke( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response )

Dispatch route callable against current Request and Response objects

Dispatch route callable against current Request and Response objects

This method invokes the route object's callable. If middleware is registered for the route, each callable middleware is invoked in the order specified.

Parameters

$request
The current Request object
$response
The current Response object

Returns

Psr\Http\Message\ResponseInterface

Throws

Exception
if the route callable throws an exception

Implementation of

Slim\Interfaces\RouteInterface::__invoke()

Methods inherited from Slim\Routable

add(), getMiddleware(), getPattern(), setContainer(), setPattern()

Methods used from Slim\MiddlewareAwareTrait

addMiddleware(), callMiddlewareStack(), seedMiddlewareStack()

Methods used from Slim\CallableResolverAwareTrait

resolveCallable()

Properties summary

protected string[] $methods

HTTP methods supported by this route

HTTP methods supported by this route

# []
protected string $identifier

Route identifier

Route identifier

#
protected null|string $name

Route name

Route name

#
protected Slim\RouteGroup[] $groups

Parent route groups

Parent route groups

#
protected boolean|string $outputBuffering

Output buffering mode

Output buffering mode

One of: false, 'prepend' or 'append'

# 'append'
protected array $arguments

Route parameters

Route parameters

# []
protected callable $callable

The callable payload

The callable payload

#

Properties inherited from Slim\Routable

$container, $middleware, $pattern

Properties used from Slim\MiddlewareAwareTrait

$middlewareLock, $stack

Magic properties used from Slim\CallableResolverAwareTrait

$container

API documentation generated by ApiGen