Skip to content
Nav

Inertia SSR

composer require langsys/langsys-php-laravel
Packagist version Monthly downloads License PHP 8.1+ Laravel 10 / 11 / 12

Hand the server-fetched catalog to the JS SDK so the client skips its initial fetch:

app/Http/Middleware/HandleInertiaRequests.php
use Langsys\Laravel\Support\InertiaSsrProps;
public function share(Request $request): array
{
return [...parent::share($request), ...InertiaSsrProps::share()];
}
// resources/js — Vue example (same shape for React/Svelte)
import { LangsysApp, useLocaleStore } from 'langsys-js-vue';
const { store } = useLocaleStore(props.langsys.initialTranslationsLocale);
LangsysApp.init({
projectid: import.meta.env.VITE_LANGSYS_PROJECT_ID,
key: import.meta.env.VITE_LANGSYS_API_KEY, // read-only key on the client
UserLocaleStore: store,
initialTranslations: props.langsys.initialTranslations,
initialTranslationsLocale: props.langsys.initialTranslationsLocale,
});
Feedback