Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jnvsor/composite-matcher
A composite matcher that runs RequestMatchers in sequence to find a match
https://github.com/jnvsor/composite-matcher
routing symfony
Last synced: about 1 month ago
JSON representation
A composite matcher that runs RequestMatchers in sequence to find a match
- Host: GitHub
- URL: https://github.com/jnvsor/composite-matcher
- Owner: jnvsor
- License: gpl-3.0
- Created: 2017-05-27T19:58:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-27T20:34:28.000Z (over 7 years ago)
- Last Synced: 2024-05-09T14:03:56.466Z (6 months ago)
- Topics: routing, symfony
- Language: PHP
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CompositeMatcher
Provides a "Composite matcher" for `symfony/routing` that takes multiple matchers and runs them in sequence.
Useful for duplicating overly-complex legacy routing systems.
## Example using Silex
```php
addMatcher(new RedirectableUrlMatcher($app['routes'], $app['request_context']));
$ret->addMatcher(new CatchLeftoversMatcher());return $ret;
};$app->get('/', function(){
return 'woot?';
});$app->run();
class CatchLeftoversMatcher implements RequestMatcherInterface {
public function matchRequest(Request $r) {
if ($r->getPathInfo() != '/test/') {
throw new ResourceNotFoundException();
}return [
'test' => 'test',
'foo' => 'bar',
'_controller' => function(){
return 'waat?';
},
];
}
}
```## Requirements
Should work down to 5.4, but I'm only running CI on 5.6+
Depends on `symfony/http-foundation` and `symfony/routing`