Skip to content

feat: unify php_server logic#2499

Draft
AlliBalliBaba wants to merge 33 commits into
mainfrom
refactor/phpserver
Draft

feat: unify php_server logic#2499
AlliBalliBaba wants to merge 33 commits into
mainfrom
refactor/phpserver

Conversation

@AlliBalliBaba

Copy link
Copy Markdown
Contributor

Currently the concept of a php_server only exists on the caddy side and not the FrankenPHP side.
Lately we have been moving more and more in a direction of scoping requests or workers to specific php_server blocks.

This PR is an attempt at refactoring the current php_server logic so it is properly mirrored on the FrankenPHP side without BC breaks for library users (and to prevent future bugs like mentioned in #2487)

Comment thread options.go Outdated
Comment thread options.go Outdated
Comment thread options.go Outdated
Comment thread phpserver.go Outdated
@AlliBalliBaba

Copy link
Copy Markdown
Contributor Author

The public api is now minimized to these 4 functions:

// server registration
func WithServer(idx int, resolvedDocumentRoot string,splitPath []string,env map[string]string) Option

// worker scoping
func WithWorkerServerScope(serverIdx int) WorkerOption
func WithWorkerMatcher(matcherFunc func(*http.Request) bool) WorkerOption

// request scoping, less overhead than WithWorkerRequestScope()
func ServeHTTPSrv(serverIdx int, responseWriter http.ResponseWriter, request *http.Request, opts ...RequestOption) error

This PR also removes the circular fc -> request dependency, which allows simplifying the contextHolder and saving some overhead.

@AlliBalliBaba AlliBalliBaba changed the title refactor: unify php_server logic feat: unify php_server logic Jul 5, 2026
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.

2 participants