Skip to content

Configuration ​

The SDK is configured through Core's config/ui5.php. The SDK has no config file of its own to publish — its defaults merge into the ui5.* keys — so publish Core's file once and set the keys below:

bash
php artisan vendor:publish --tag=ui5-config

The values shown are the composition we run in production.

Registry and context ​

php
'registry'        => \LaravelUi5\Sdk\Platform\SdkRegistry::class,
'context_factory' => \LaravelUi5\Sdk\Platform\Context\SdkUi5ContextFactory::class,

SdkRegistry discovers your modules live. The SDK also ships a precompiled CachedRegistry, which reads bootstrap/cache/ui5.php and nothing else; bind it in production once your artifact set is settled. Since 1.2.0 that costs you nothing at deploy time — ui5:sync, ui5:cache and ui5:nav work on the live registry whatever is bound. See Deployment.

The context factory builds the SdkContext every request carries: the acting and the authenticated partner, the tenant, the moment, the abilities and the settings. See The Core Seam.

Middleware — the UI5 route stack ​

php
'middleware' => [
    'web',
    \LaravelUi5\Core\Http\Middleware\ResolveUi5Context::class,
    \LaravelUi5\Core\Http\Middleware\EnsureUi5Authenticated::class,
    \LaravelUi5\Sdk\Http\Middleware\CheckAuthMiddleware::class,
],

Keep 'web' first: without it the stack has no session. CheckAuthMiddleware is the SDK's access check — an app's #[Access] gate answers 403 here — and it must run after context resolution, which is why the host owns the order.

Everything under the ui5: prefix is a JSON surface, web session and all. A fresh Laravel app already treats it as one — the default rule is expectsJson(), and the SDK's client sends Accept: application/json — so there is nothing to configure. The one thing worth knowing is what undoes it: shouldRenderJsonWhen() in bootstrap/app.php replaces that rule rather than adding to it, so a callback like fn ($request) => $request->is('api/*') turns every refusal on a UI5 action route back into a redirect the client follows and swallows. If you pass one, make it a superset.

OData middleware — the OData route stack ​

OData routes use a separate stack, because the OData chain has no context-resolution step of its own:

php
'odata_middleware' => [
    'web',
    \LaravelUi5\Core\Http\Middleware\FetchCsrfToken::class,
    \LaravelUi5\Core\Http\Middleware\ResolveODataEndpoint::class,
    \LaravelUi5\Core\Http\Middleware\EnsureODataAuthenticated::class,
    \LaravelUi5\Sdk\Http\Middleware\BindSdkContextForOData::class,
],

BindSdkContextForOData invokes the same context factory, so scoped entity sets get an SdkContext; without it they fail closed to 1 = 0. It is ordered after endpoint resolution and authentication. See Scoped Entity Sets.

Artifact resolvers ​

php
'artifact_resolvers' => [
    \LaravelUi5\Core\Runtime\PathBasedArtifactResolver::class,
    \LaravelUi5\Sdk\Platform\Context\ShellContextArtifactResolver::class,
    \LaravelUi5\Sdk\Export\ExportArtifactResolver::class,
],

The first resolver that claims a request wins. A resolver missing from this list does not degrade its feature — it makes the endpoint answer 404: the shell's context without the second, table export without the third.

Modules ​

php
'modules' => [
    \App\Sales\SalesModule::class,
],

List every business module the host installs; only modules listed here are visible. Infrastructure modules register themselves — the SDK's Launchpad, Partners and Settings apps, and laravelui5/auth if you use it.

The system actor ​

The SDK attributes writes that no person makes — for example the provenance ui5:sync stamps on default settings — to one partner: the platform owner that ui5:intake creates. The SDK reads its id from ui5.system_actor_id, which defaults to env('UI5_SYSTEM_ACTOR_ID', 1). On a fresh database the owner gets id 1 and there is nothing to set; ui5:intake tells you if yours differs.

Replacing a service ​

Every service the SDK ships is bound to an interface in its service provider. Rebind one in your AppServiceProvider — for example, a tenant resolver that reads your real operating organisation:

php
$this->app->singleton(
    \LaravelUi5\Sdk\Tenancy\Contracts\TenantResolverInterface::class,
    \App\Tenancy\OperatorTenantResolver::class,
);

Shell services ​

ui5.shell.services maps a shell service — a class or a container binding — to its configuration array, for example 'discovery.search' => ['limit' => 1000]. Services that accept configuration implement LaravelUi5\Sdk\Shell\Contracts\ConfigurableServiceInterface.

See also ​