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

Priority system #5

Closed
joelwurtz opened this issue Nov 8, 2015 · 4 comments
Closed

Priority system #5

joelwurtz opened this issue Nov 8, 2015 · 4 comments
Labels

Comments

@joelwurtz
Copy link
Member

Actually all the plugins can be defined in any order (and it will be better that way).

However order matter as some plugins will work better if there are in first or last position.

Example, the retry plugin will be better at the end of chain for optimization reason.

The logger plugin and all data collector thing would also be better at the end of the chain to have complete information about the request (If the logger is before the cookie plugin for example it will not log the cookie headers :/)

I was wondering how do we expose this order thing, documentation ? or something which should be add with a factory ?

For the moment the order of plugins should be like this :

  1. First are all the plugins which modify the request / response part (authentication, cookie, sanitize, deflate, ...)
  2. Second are the plugins which interacts with the workflow of the call (retry, redirect, validator, ....)
  3. Finally all the plugins used for debugging, acessing the information (logger, php vcr, history, ...)
@sagikazarmark
Copy link
Member

To see a priority queue implementation: https://github.com/portphp/steps

In case of Tactician we followed a "user-responsibility" logic: it belongs to the user to decide.

Actually, I think that in case of Middleware implementations, it should belong to the user. But such priority solution, as in case of portphp/steps, could also work.

@dbu
Copy link
Contributor

dbu commented Nov 9, 2015 via email

@joelwurtz
Copy link
Member Author

I was also thinking about providing a factory for plugin(s), (certainly in another repository), the points is to be able to having different stack of plugins per request the priority system can be used here also.

@joelwurtz
Copy link
Member Author

It's explained in the documentation.

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

No branches or pull requests

3 participants