8000 minor #10790 Doc CompiledUrlMatcherDumper instead of PhpMatcherDumper… · symfony/symfony-docs@0f790dc · GitHub
[go: up one dir, main page]

Skip to content

Commit 0f790dc

Browse files
committed
minor #10790 Doc CompiledUrlMatcherDumper instead of PhpMatcherDumper (nicolas-grekas)
This PR was merged into the master branch. Discussion ---------- Doc CompiledUrlMatcherDumper instead of PhpMatcherDumper Needed after symfony/symfony#28865 Commits ------- 8e8df56 Doc CompiledUrlMatcherDumper instead of PhpMatcherDumper
2 parents 2afa75a + 8e8df56 commit 0f790dc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

create_framework/routing.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ generate absolute URLs::
217217
highly optimized URL matcher class that can replace the default
218218
``UrlMatcher``::
219219

220-
$dumper = new Routing\Matcher\Dumper\PhpMatcherDumper($routes);
220+
use Symfony\Component\Routing\Matcher\CompiledUrlMatcher;
221+
use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper;
221222

222-
echo $dumper->dump();
223+
// $compiledRoutes is a plain PHP array that describes
224+
// all routes using a performant data format
225+
// you can and SHOULD cache it, typically by exporting it to a PHP file
226+
$compiledRoutes = (new CompiledUrlMatcherDumper($routes))->getCompiledRoutes();
227+
228+
$matcher = new CompiledUrlMatcher($compiledRoutes, $context);

0 commit comments

Comments
 (0)
0