d7870a2b5d
* 2.6: (46 commits) fixxed order of usage [2.7] [Form] Replaced calls to array_search() by in_array() where is no need to get the index [Process] Make test AbstractProcessTest::testStartAfterATimeout useful again removed non-sense example Fixes small typo. [Validator] Remove unnecessary include in tests [HttpFoundation] minor: clarify Request::getUrlencodedPrefix() regex fixed typo [Validator] fix DOS-style line endings Drop useless execution bit bumped Symfony version to 2.6.5 [Serializer] update changelog updated VERSION for 2.6.4 updated CHANGELOG for 2.6.4 bumped Symfony version to 2.5.11 [HttpKernel] Added use of provided by #12022 method to instantiate controller class in bundle's controller resolver updated VERSION for 2.5.10 updated CHANGELOG for 2.5.10 [Validator] Add a Russian translation for invalid charset message [2.3] [Validator] spanish translation for invalid charset message ... Conflicts: src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php src/Symfony/Component/HttpKernel/Exception/FatalErrorException.php src/Symfony/Component/HttpKernel/Exception/FlattenException.php src/Symfony/Component/HttpKernel/Kernel.php src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php src/Symfony/Component/Validator/Resources/translations/validators.de.xlf src/Symfony/Component/Validator/Resources/translations/validators.en.xlf src/Symfony/Component/Validator/Resources/translations/validators.es.xlf src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf |
||
---|---|---|
.. | ||
Annotation | ||
Exception | ||
Generator | ||
Loader | ||
Matcher | ||
Tests | ||
.gitignore | ||
CHANGELOG.md | ||
CompiledRoute.php | ||
composer.json | ||
LICENSE | ||
phpunit.xml.dist | ||
README.md | ||
RequestContext.php | ||
RequestContextAwareInterface.php | ||
Route.php | ||
RouteCollection.php | ||
RouteCompiler.php | ||
RouteCompilerInterface.php | ||
Router.php | ||
RouterInterface.php |
Routing Component
Routing associates a request with the code that will convert it to a response.
The example below demonstrates how you can set up a fully working routing system:
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
$routes = new RouteCollection();
$routes->add('hello', new Route('/hello', array('controller' => 'foo')));
$context = new RequestContext();
// this is optional and can be done without a Request instance
$context->fromRequest(Request::createFromGlobals());
$matcher = new UrlMatcher($routes, $context);
$parameters = $matcher->match('/hello');
Resources
You can run the unit tests with the following command:
$ cd path/to/Symfony/Component/Routing/
$ composer.phar install
$ phpunit