Skip to content

Configuration params

Params for the Yii3 configuration, under the crenspire/yii3-inertia key. Values set in your application are merged over these defaults.

php
return [
    'crenspire/yii3-inertia' => [
        'rootView' => '@root/resources/views/inertia.php',
        'viewParameters' => [],
        'version' => null,
        'manifestPath' => null,
        'sharedProps' => [],
        'encryptHistory' => false,
        'allErrors' => false,
        'vite' => [
            'publicPath' => '@public',
            'buildDirectory' => 'build',
            'manifest' => '.vite/manifest.json',
            'devServerUrl' => null,
            'hotFile' => 'hot',
            'baseUrl' => '@baseUrl',
        ],
        'ssr' => [
            'enabled' => false,
            'url' => 'http://127.0.0.1:13714/render',
            'except' => [],
            'throwOnError' => false,
        ],
    ],
];

General

ParamTypeDefaultDescription
rootViewstring@root/resources/views/inertia.phpPHP template for the first visit. Aliases are resolved.
viewParametersarray[]Extra root view variables. A Closure is called with the container.
versionstring|callable|nullnullAsset version. null hashes the manifest.
manifestPathstring|nullnullFile hashed when version is null. null uses the Vite manifest.
sharedPropsarray[]Props added to every page.
encryptHistoryboolfalseEncrypt history state for every page.
allErrorsboolfalseSend all validation messages per field.

vite

ParamTypeDefaultDescription
publicPathstring@publicFilesystem path of the web root.
buildDirectorystringbuildBuild directory relative to the web root.
manifeststring.vite/manifest.jsonManifest path relative to the build directory.
devServerUrlstring|nullnullDev server URL.
hotFilestringhotFile in the web root that enables dev mode. '' disables it.
baseUrlstring@baseUrlURL of the web root.

ssr

ParamTypeDefaultDescription
enabledboolfalseRender pages on the server.
urlstringhttp://127.0.0.1:13714/renderSSR server endpoint.
exceptlist<string>[]Path prefixes that are never rendered on the server.
throwOnErrorboolfalseThrow SSR failures instead of logging them.

Released under the MIT License.