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

before() #63

Closed
DaanSchoukens opened this issue Dec 14, 2014 · 4 comments
Closed

before() #63

DaanSchoukens opened this issue Dec 14, 2014 · 4 comments

Comments

@DaanSchoukens
Copy link

Hi, quick question,
what is the alternative to the before() method in the latest release?

@noodlehaus
Copy link
Owner

sorry, there's still no replacement for before() in the current version. this is being worked on, though it might not be implemented the same way as we had it before.

@bmcminn
Copy link

bmcminn commented May 12, 2016

Hey @noodlehaus, any update on this? getting to a point in an application where a before() method would really help authenticate a series of API endpoints I'm writing.

@noodlehaus
Copy link
Owner

Sorry I never got back to this. I am working on bringing back the functionality as apply($path, ...$handlers), like the following:

# apply auth() and loadBook() under this route
apply('/record/:id', auth(...), loadBook(...));

# auth() and loadBook() should have been executed
route('GET', '/record/:id/edit, showEditBookForm(...));

This would require a way to forward values from the middleware to the next handlers, for cases where the middleware is used for preparing the context for the final handlers. For ones that divert handling, this is not an issue.

Another approach might be to just allow multiple callables in the route() method like so:

route('GET', '/admin', auth(...), showDashboard(...));

Looking into this finally.

@noodlehaus
Copy link
Owner

Closing this. Features already in #90. Just verifying the minimum required PHP version for these (8+).

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

No branches or pull requests

3 participants