laravel-rtl-starter maintained by mohamed-haroun
laravel-rtl-starter
A small Arabic-first kit for Laravel: pick the locale per request, flip the page to RTL, and get Arabic validation messages.
العربية | English
composer require mohamed-haroun/laravel-rtl-starter
What you get
SetLocalemiddleware:?lang=aror?lang=en, remembered in the session, limited to the locales you allow<x-rtl::layout>Blade component with the rightlanganddirand the Cairo font@dirdirective that printsrtlorltrfor the current localeDirection::dir('ar')helper for your own code- Arabic validation messages, publishable
Use
Register the middleware in bootstrap/app.php:
->withMiddleware(function (Middleware $middleware) {
$middleware->web(append: [\MohamedHaroun\RtlStarter\Http\Middleware\SetLocale::class]);
})
Wrap a page:
<x-rtl::layout title="Home">
<h1>{{ __('Welcome') }}</h1>
</x-rtl::layout>
Publish the Arabic validation messages and config:
php artisan vendor:publish --tag=rtl-starter-lang
php artisan vendor:publish --tag=rtl-starter-config
For Tailwind, use logical utilities (ms-4, ps-4, text-start) instead of ml-4, pl-4, text-left so one template works in both directions.
Status
The first release covers the locale switch, the layout and a core set of Arabic validation messages. The message list is not the full Laravel set yet: pull requests that add missing rules are welcome.
بالعربي
حزمة Laravel صغيرة للمشاريع العربية: تغيير اللغة لكل طلب، قلب الصفحة لـ RTL، ورسائل تحقق بالعربي.
composer require mohamed-haroun/laravel-rtl-starter
<x-rtl::layout title="الرئيسية">
<h1>أهلًا</h1>
</x-rtl::layout>
نصيحة Tailwind: استخدم ms-4 وps-4 وtext-start بدل ml-4 وpl-4 وtext-left عشان نفس القالب يشتغل في الاتجاهين. رسائل التحقق الحالية مش كاملة، وأي Pull Request بيضيف قواعد ناقصة مرحب بيه.
Tests
composer install && vendor/bin/phpunit
License
MIT