phpinnacle / babylon
Locale selection and session-based localization for Laravel Filament panels.
Requires
- php: ^8.4
- phpinnacle/common: ^1.0
- phpinnacle/intl: ^1.0
- spatie/laravel-package-tools: ^1.92
This package is auto-updated.
Last update: 2026-09-01 15:41:14 UTC
README
Babylon adds locale selection to a Filament panel. It keeps the selected locale in the session, applies it through panel middleware, and provides a ready-to-use language selector for the Filament profile form.
Features
- Panel-scoped locale middleware.
- Configurable list of available locales.
- Locale selector for the user profile schema.
- Locale names supplied by
phpinnacle/common. - No database tables or published assets.
Requirements
- PHP 8.4 or later
- Laravel 13
- Filament 5
phpinnacle/common
Installation
composer require phpinnacle/babylon
Registering the plugin
Register BabylonPlugin in the panel and pass the locales that users may select:
use Filament\Panel; use PHPinnacle\Babylon\BabylonPlugin; public function panel(Panel $panel): Panel { return $panel->plugin( BabylonPlugin::make()->locales('en', 'pl', 'ru'), ); }
The plugin registers SetLocale as persistent panel middleware. The selected value is read from the session key locale; when it is absent, Laravel's configured application locale remains in effect.
Adding the profile selector
Use the packaged section when composing a custom profile form:
use PHPinnacle\Babylon\BabylonPlugin; return [ BabylonPlugin::profile(), ];
The selector only contains locales passed to locales(). Locale codes should be valid entries supported by PHPinnacle\Intl\Locales.
Testing
composer test
Changelog
See CHANGELOG for recent changes.
License
The MIT License (MIT). See License File.