Skip to content

Base Attribute Middleware and Router update#10442

Open
regisoc wants to merge 4 commits intoaces:mainfrom
regisoc:20260402_middleware_chain_and_router_update
Open

Base Attribute Middleware and Router update#10442
regisoc wants to merge 4 commits intoaces:mainfrom
regisoc:20260402_middleware_chain_and_router_update

Conversation

@regisoc
Copy link
Copy Markdown
Collaborator

@regisoc regisoc commented Apr 8, 2026

Brief summary of changes

This PR adds:

  • a first middleware RequestAttributeBuilder: placed at the top of the middleware chain to initialize some essential attributes when receiving a request i.e. loris, user, baseurl. This helps extract base attribute from any received request further down the chain or even after.
  • a second middleware RedirectControl: to control redirect query parameter if set. It will control if the redirect URL query parameter is targeting the current host from the server.
  • refactors a bit the base router to get attributes from the change in middlewares.

@regisoc regisoc requested a review from driusan April 8, 2026 19:18
@regisoc regisoc added Language: PHP PR or issue that update PHP code Category: Refactor PR or issue that aims to improve the existing code labels Apr 8, 2026
@MaximeBICMTL
Copy link
Copy Markdown
Contributor

MaximeBICMTL commented Apr 14, 2026

I like this PR!

Random thought out of scope for this PR, but would it be desirable to have a custom LorisRequest (or LorisRequestInterface) type that extends ServerRequestInterface with typed attributes/getters for loris and user such that these important objects can be type checked / have auto-complete / are more discoverable 🤔.

Or alternatively, some functions getLoris($request) or getUser($request) that use the standard ServerRequestInterface 🤔.

@regisoc
Copy link
Copy Markdown
Collaborator Author

regisoc commented Apr 14, 2026

Yes. This is a first PR to allow all parameters to be accessible down the pipe.
We can add and control much more down the line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Refactor PR or issue that aims to improve the existing code Language: PHP PR or issue that update PHP code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants