@@ -396,6 +396,48 @@ use the ``isPrivateIp()`` method from the
396396
397397 The ``isPrivateIp() `` method was introduced in Symfony 6.3.
398398
399+ Matching a Request Against a Set Rules
400+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
401+
402+ If you need to match a request against a set of rules, you can use
403+ request matchers. The HttpFoundation component provides many matchers
404+ to be used:
405+
406+ *:class: `Symfony\\ Component\\ HttpFoundation\\ RequestMatcher\\ AttributesRequestMatcher `
407+ *:class: `Symfony\\ Component\\ HttpFoundation\\ RequestMatcher\\ ExpressionRequestMatcher `
408+ *:class: `Symfony\\ Component\\ HttpFoundation\\ RequestMatcher\\ HostRequestMatcher `
409+ *:class: `Symfony\\ Component\\ HttpFoundation\\ RequestMatcher\\ IpsRequestMatcher `
410+ *:class: `Symfony\\ Component\\ HttpFoundation\\ RequestMatcher\\ IsJsonMatcher `
411+ *:class: `Symfony\\ Component\\ HttpFoundation\\ RequestMatcher\\ MethodRequestMatcher `
412+ *:class: `Symfony\\ Component\\ HttpFoundation\\ RequestMatcher\\ PathRequestMatcher `
413+ *:class: `Symfony\\ Component\\ HttpFoundation\\ RequestMatcher\\ PortRequestMatcher `
414+ *:class: `Symfony\\ Component\\ HttpFoundation\\ RequestMatcher\\ SchemeRequestMatcher `
415+
416+ You can either use them directly or combine them using the
417+ :class: `Symfony\\ Component\\ HttpFoundation\\ ChainRequestMatcher `
418+ class::
419+
420+ use Symfony\Component\HttpFoundation\ChainRequestMatcher;
421+ use Symfony\Component\HttpFoundation\RequestMatcher\HostRequestMatcher;
422+ use Symfony\Component\HttpFoundation\RequestMatcher\PathRequestMatcher;
423+ use Symfony\Component\HttpFoundation\RequestMatcher\SchemeRequestMatcher;
424+
425+ // use only one criteria to match the request
426+ $schemeMatcher = new SchemeRequestMatcher('https');
427+ if ($schemeMatcher->matches($request)) {
428+ // ...
429+ }
430+
431+ // use a set of criteria to match the request
432+ $matcher = new ChainRequestMatcher([
433+ new HostRequestMatcher('example.com'),
434+ new PathRequestMatcher('/admin'),
435+ ]);
436+
437+ if ($matcher->matches($request)) {
438+ // ...
439+ }
440+
399441Accessing other Data
400442~~~~~~~~~~~~~~~~~~~~
401443