These examples show how to configure a custom route type to read from a repository service (which is array-backed for simplicity) and route to a custom controller that receives an already hydrated entity as a request parameter.
-
add following to your
composer.json
:{ "repositories": [ { "url": "https://github.com/Ocramius/RoutingExamples.git", "type": "git" } ], "require": { "ocramius/routing-examples": "dev-master" } }
-
run
composer update
-
add
"RoutingExamples"
to the"modules"
key inconfig/application.config.php
. -
start a web server via
php -S localhost:8080 -t public
-
browse to
http://localhost:8080/
, thenhttp://localhost:8080/home
, thenhttp://localhost:8080/contacts
and thenhttp://localhost:8080/team