Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Skip dispatch after match #120

Open
fitdev-pro opened this issue Jun 5, 2017 · 4 comments
Open

Skip dispatch after match #120

fitdev-pro opened this issue Jun 5, 2017 · 4 comments
Assignees

Comments

@fitdev-pro
Copy link

  • PHPRouter version: 1.2.0-alpha
  • PHP version: PHP 7.1:
  • Exact steps to cause this issue
    1. I configured RouteCollection
    2. I run method matchCurrentRequest on Router
  • What you expected
    • I expected to get all information about route and use this information in other middleware using psr 15
  • What happened instead
    • Router create controller object and run the action

Is it possible to turn of run method dispatch() after find route by configuration flag.

@lpotherat
Copy link
Contributor

lpotherat commented Jun 6, 2017

It would be great !
it reminds me a feature request here : #115 .

I have a private fork with a simple mecanism, i could make a pull request on this if owners change their minds.

@malukenho
Copy link

@lpotherat please do it, send a PR.

@malukenho malukenho self-assigned this Jun 6, 2017
@lpotherat
Copy link
Contributor

PR made here #121 .
It is a simple implementation that fit my needs, it may be enhanced.

@animalillo
Copy link

As to avoid touching the lib and keeping it detached from the project and maintained via composer i have created this little wrapper to fit my functionality in a little dirty clever way so i can get the url in the middle of the request process instead of after the request process. A neat improvement would be to have ALL the request information available as a Router->getRequestInfo method or something like that.

Having it returned after the full request has been processed is nice and all, but is information you might need in the middle of the process more that at the end.

Here is my little code: https://gist.github.com/animalillo/e395beed4919a4325c8fdb26b7803e84

Another nice feature would be to set a base namespace for all the classes that run your routes and don't have to repeat the namespace for every route.

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

No branches or pull requests

4 participants