Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add request matcher #32

Merged
merged 1 commit into from
Feb 19, 2016
Merged

Add request matcher #32

merged 1 commit into from
Feb 19, 2016

Conversation

joelwurtz
Copy link
Member

/**
* Decides whether the rule(s) implemented by the strategy matches the supplied request.
*
* Equivalent of https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/RequestMatcherInterface.php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PSR-7 implementation of Symfony's RequestMatcher

@see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/RequestMatcherInterface.php

@sagikazarmark
Copy link
Member

Other possible matchers to add:

  • CallbackMatcher
  • ChainMatcher (AND or OR logic?)

@sagikazarmark
Copy link
Member

LGTM 👍

@joelwurtz
Copy link
Member Author

Other matchers for another PR when we need it :)

joelwurtz added a commit that referenced this pull request Feb 19, 2016
@joelwurtz joelwurtz merged commit 62e9ff4 into master Feb 19, 2016
@sagikazarmark sagikazarmark deleted the feature/request-matcher branch February 19, 2016 15:03
@dbu
Copy link
Contributor

dbu commented Feb 19, 2016

i like the symfony approach to this better, actually: https://github.com/symfony/symfony/blob/582f4753a343f230fbe18b4e9a0747d48351ddfb/src/Symfony/Component/HttpFoundation/RequestMatcher.php

if we have a separate matcher for each part of the request, we build huge object trees.
i don't know if anybody ported the symfony request matcher to PSR-7 yet, if not this library could be a good place for it. though it might be worth to have it stand alone as it could be useful even when not using anything else from PHP-HTTP.

@sagikazarmark
Copy link
Member

I don't see a reason why the regex one could not live together with the one you linked.

The message library is not dedicated to PHP-HTTP packages (but rather to PSR-7 as a utility package), so IMO we can have it in here. There aren't any heavy dependencies. (BTW: We should ask the FIG if they want a http-message-utils repo, similarly to cache-utils.)

But I am not against separating it to be standalone. (One reason against it: makes it harder to use it INSIDE message. For example I would use it the Matching authentication)

@dbu
Copy link
Contributor

dbu commented Feb 19, 2016 via email

@joelwurtz
Copy link
Member Author

my unhappiness with the RegexRequestMatcher is that it is only matching
one thing

It's just a first implementation to have a simple example, as i'm only interested in the interface for the moment, will certainly write other implementations at a latter time :)

It can be renamed if you want, also didn't want a too long name, but yeah RegexUriRequestMatcher may be cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants