Search by

mohamed-haroun / laravel-rtl-starter

king980

Arabic-first RTL kit for Laravel: locale switcher middleware, RTL Blade layout, Arabic validation messages.

Package info

github.com/mohamed-haroun/laravel-rtl-starter

pkg:composer/mohamed-haroun/laravel-rtl-starter

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-12-02 09:16 UTC

This package is auto-updated.

Last update: 2026-12-02 09:45:59 UTC


README

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

  • SetLocale middleware: ?lang=ar or ?lang=en, remembered in the session, limited to the locales you allow
  • <x-rtl::layout> Blade component with the right lang and dir and the Cairo font
  • @dir directive that prints rtl or ltr for the current locale
  • Direction::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