Skip to content

docs: document using FrankenPHP as a Go library#2531

Open
nicolas-grekas wants to merge 1 commit into
php:refactor/phpserverfrom
nicolas-grekas:library-docs
Open

docs: document using FrankenPHP as a Go library#2531
nicolas-grekas wants to merge 1 commit into
php:refactor/phpserverfrom
nicolas-grekas:library-docs

Conversation

@nicolas-grekas

Copy link
Copy Markdown
Contributor

Follow-up to #2499, targeting refactor/phpserver. Docs-only.

The refactor introduces new public API for library users (NewServer, WithServer, Server.ServeHTTP, WithWorkerServerScope, WithWorkerMatcher) with no documentation outside godoc. This adds a docs/library.md page covering:

  • minimal setup: NewServer + Init(WithServer(...)) + Server.ServeHTTP as an http.Handler
  • registering multiple servers (the library equivalent of multiple php_server blocks)
  • scoping workers to a server, by path and by request matcher
  • per-request options
  • the compatibility path: package-level ServeHTTP() keeps working through the fallback server

Also linked from the README docs list and llms.txt. The examples follow the current NewServer signature on the branch; if #2529 lands first, the snippets need a one-line update (happy to rebase either way). Translations are left to the usual translation update flow.

The Server refactor introduces new public API (NewServer, WithServer,
Server.ServeHTTP, WithWorkerServerScope, WithWorkerMatcher) that had
no documentation outside of godoc. Adds a docs page covering the
library flow, multiple servers, worker scoping, per-request options
and the compatibility path for the pre-Server API.

@alexandre-daubois alexandre-daubois left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! We should wait for #2499 to be stabilized. Or is it already?

Comment thread docs/library.md
Comment thread docs/library.md
Comment thread docs/library.md
Comment thread docs/library.md
@AlliBalliBaba

Copy link
Copy Markdown
Contributor

This doesn't necessarily be part of #2499, but we can merge it in 👍

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.

3 participants