Skip to content

Instantly share code, notes, and snippets.

@DASPRiD
Last active December 20, 2015 11:49
Show Gist options
  • Save DASPRiD/6126256 to your computer and use it in GitHub Desktop.
Save DASPRiD/6126256 to your computer and use it in GitHub Desktop.
Prepending a route programatically.
<?php
$statusRoute = $routeStack->getRoute('status');
$versionRoute = new Segment('/v:version');
$chainRoute = new Chain(array($versionRoute, $statusRoute), $routeStack->getRoutePluginManager(), null);
$routeStack->removeRoute('status'); // Not really required, as addRoute() will override this anyway… just for completeness.
$routeStack->addRoute('status', $chainRoute);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment