Laravel SDK
composer require langsys/langsys-php-laravel Integrate the Langsys Translation Manager into a Laravel application — Blade, Livewire, Alpine’s server-rendered content, and Inertia SSR seeding for the JS SDKs.
This is the reference for langsys/langsys-php-laravel. For a walkthrough with a demo app, see the Laravel Learning Center page.
Requirements
Section titled “Requirements”- PHP 8.1+, Laravel 10, 11, or 12
ext-intl(required — ICU plural rules and locale-aware number/date formatting). Note that the officialphp:8.x-fpmDocker images do not bundle it; adddocker-php-ext-install intl.
How it’s layered
Section titled “How it’s layered”langsys/langsys-php-laravel is a Laravel wrapper over the dependency-free langsys/langsys-php — which owns the HTTP client, phrase lookup, placeholder interpolation, token discovery/queueing, and catalog caching. This package adds only the Laravel-native concerns:
- A service provider that builds the SDK
Clientfromconfig/langsys.phpand routes catalog caching through Laravel’s cache (any store — redis, memcached, file, array) - A
t()helper and@tBlade directive exposing the SDK’s{name}interpolation and ICU pluralization to Blade — the same phrase syntax as the Langsys JS SDKs, so one catalog serves your whole stack - A
DetectLocalemiddleware resolving the request locale (query → cookie → session →Accept-Language) - A
FlushPendingRegistrationsterminable middleware (plus an Octane listener) that sends newly discovered phrases to Langsys after the response - An opt-in
TranslateResponsemiddleware that translates whole rendered HTML responses, for projects that want coverage without hand-tagging - An
InertiaSsrPropshelper that seeds the JS SDKs’initialTranslationsfor SSR handoff
In this package
Section titled “In this package” Install Composer, .env, and locale/flush middleware for Laravel 10–12. Using translations @t, t(), interpolation, locale detection, Livewire, and flushing. Automatic translation Translate whole HTML responses without tagging every string. Inertia SSR Hand the JS SDKs the server's catalog so the client doesn't refetch it. Facade & client The Langsys facade and the underlying PHP SDK client. Configuration config/langsys.php and faking the client in tests.