Download the PHP package mwstake/mediawiki-component-wellknown without Composer
On this page you can find all versions of the php package mwstake/mediawiki-component-wellknown. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mwstake/mediawiki-component-wellknown
More information about mwstake/mediawiki-component-wellknown
Files in mwstake/mediawiki-component-wellknown
Package mediawiki-component-wellknown
Short Description Exposes a /.well-known/ REST endpoint with a registry for virtual files
License GPL-3.0-only
Informations about the package mediawiki-component-wellknown
MediaWiki Stakeholders Group - Components
WellKnown for MediaWiki
Provides a /.well-known/{filename} REST endpoint with a registry for virtual files,
following RFC 8615.
This code is meant to be executed within the MediaWiki application context. No standalone usage is intended.
Compatibility
1.0.x-> MediaWiki 1.43
Use in a MediaWiki extension
Require this component in the composer.json of your extension:
Services
| Service name | Class | Description |
|---|---|---|
MWStake.WellKnown.FileRegistry |
FileRegistry |
Registry where components register virtual files |
Registering a well-known file
Register files in an ExtensionFunctions callback or during component bootstrap.
Each registration requires a filename, a content callback, and a content type:
The content callback is invoked on each request — you can return dynamic content.
Parameters
| Parameter | Type | Description |
|---|---|---|
$filename |
string | The filename portion of the URL (e.g. jwks.json → /.well-known/jwks.json) |
$contentCallback |
callable | Returns the file content as a string |
$contentType |
string | MIME type for the Content-Type response header |
Accessing well-known files
Files are served at:
For example:
Nginx rewrite (optional)
To serve files at the standard /.well-known/ path without the /rest.php prefix,
add a rewrite rule to your web server:
How it works
The component registers a single REST route handler (WellKnownHandler) at
/.well-known/{filename}. When a request arrives:
- The handler looks up the filename in the
FileRegistry - If found, it calls the content callback and returns the result with the registered content type
- If not found, it returns a 404 response