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\Ui5\SdkRegistry::class,
'context_factory' => \LaravelUi5\Sdk\Runtime\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\ResolveRequestLanguage::class,
    \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. ResolveRequestLanguage sets the request's language from sap-language, else Accept-Language; it goes before ResolveUi5Context, which carries the language into the context — the rail, the Weave menus and every text the server sends read it. 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\ResolveRequestLanguage::class,
    \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\Shell\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 installation is not configuration ​

Who runs the installation and its fixed values — country, base currency, time zone, decimal places — live in app/Installation.php, which ui5:intake generates and you commit (Installation and Tenant). Who answers for automated writes, whether the validation log is on and how long the logs keep their rows are settings the operator changes in the Settings app (The SDK's settings). Neither is a key in config/ui5.php.

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 finds the tenant another way:

php
$this->app->singleton(
    \LaravelUi5\Sdk\Installation\Contracts\TenantResolverInterface::class,
    \App\Tenancy\MyTenantResolver::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 ​