Silex API
Class

Silex\ControllerCollection

class ControllerCollection

Builds Silex controllers.

It acts as a staging area for routes. You are able to set the route name
until flush() is called, at which point all controllers are frozen and
converted to a RouteCollection.

Methods

__construct(Route $defaultRoute)

Constructor.

Controller match(string $pattern, mixed $to)

Maps a pattern to a callable.

Controller get(string $pattern, mixed $to)

Maps a GET request to a callable.

Controller post(string $pattern, mixed $to)

Maps a POST request to a callable.

Controller put(string $pattern, mixed $to)

Maps a PUT request to a callable.

Controller delete(string $pattern, mixed $to)

Maps a DELETE request to a callable.

__call($method, $arguments)

RouteCollection flush(string $prefix = '')

Persists and freezes staged controllers.

Details

at line 35
public __construct(Route $defaultRoute)

Constructor.

Parameters

Route $defaultRoute

at line 50
public Controller match(string $pattern, mixed $to)

Maps a pattern to a callable.

You can optionally specify HTTP methods that should be matched.

Parameters

string $pattern Matched route pattern
mixed $to Callback that returns the response when matched

Return Value

Controller

at line 69
public Controller get(string $pattern, mixed $to)

Maps a GET request to a callable.

Parameters

string $pattern Matched route pattern
mixed $to Callback that returns the response when matched

Return Value

Controller

at line 82
public Controller post(string $pattern, mixed $to)

Maps a POST request to a callable.

Parameters

string $pattern Matched route pattern
mixed $to Callback that returns the response when matched

Return Value

Controller

at line 95
public Controller put(string $pattern, mixed $to)

Maps a PUT request to a callable.

Parameters

string $pattern Matched route pattern
mixed $to Callback that returns the response when matched

Return Value

Controller

at line 108
public Controller delete(string $pattern, mixed $to)

Maps a DELETE request to a callable.

Parameters

string $pattern Matched route pattern
mixed $to Callback that returns the response when matched

Return Value

Controller

at line 113
public __call($method, $arguments)

Parameters

$method
$arguments

at line 135
public RouteCollection flush(string $prefix = '')

Persists and freezes staged controllers.

Parameters

string $prefix

Return Value

RouteCollection A RouteCollection instance