Registrar
class Registrar
Traits
Constants
| OAUTH_SCOPE |
|
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected array<string, callable> | $localServers | ||
| protected Route> | $httpServers |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Register a local server.
Register OAuth routes for a named client.
Get a local server factory.
Get a registered HTTP server route.
Get the registered servers.
Register server-side OAuth discovery and registration routes.
Get discovery metadata for a protected resource.
Determine whether an exact GET route is already registered.
Add the MCP scope when Passport is installed.
Get the client manager.
Start a server on its transport.
Details
in
Macroable at line 30
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 44
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 61
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 72
static void
flushMacros()
Flush the existing macros.
Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 83
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 108
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 52
Route
web(string $route, string $serverClass)
Register an HTTP server.
Routes and server registrations persist for the worker lifetime.
at line 82
void
local(string $handle, string $serverClass)
Register a local server.
On the shared registrar, server factories persist across requests.
at line 95
void
registerClient(string $name, Closure $factory)
Register a named client factory.
Client factories persist for the worker lifetime.
at line 104
Client
client(string $name)
Get a named client for the current owner.
at line 118
void
oAuthRoutesFor(string $client, Closure|array $handler, array|string $middleware = 'web', string|null $connectUri = null, string|null $callbackUri = null, string|null $clientMetadataUri = null, array $clientMetadata = [])
Register OAuth routes for a named client.
The routes persist for the worker lifetime.
at line 134
callable|null
getLocalServer(string $handle)
Get a local server factory.
at line 142
Route|null
getWebServer(string $route)
Get a registered HTTP server route.
at line 152
array
servers()
Get the registered servers.
at line 165
void
oauthRoutes(string $oauthPrefix = 'oauth', bool $registration = true)
Register server-side OAuth discovery and registration routes.
Routes and Passport's challenge resolver persist for the worker lifetime.
at line 209
static protected array
protectedResourceMetadata(string $path)
Get discovery metadata for a protected resource.
at line 232
protected bool
hasGetRoute(string $uri)
Determine whether an exact GET route is already registered.
at line 256
static array
ensureMcpScope()
Add the MCP scope when Passport is installed.
Passport scopes persist for the worker lifetime.
at line 276
protected ClientManager
clientManager()
Get the client manager.
at line 287
static protected mixed
startServer(string $serverClass, callable $transportFactory)
Start a server on its transport.