bramalho / laravel-locale
Laravel Locale Package
v1.0.0
2019-02-16 11:56 UTC
Requires
- php: >=7.1.3
- laravel/framework: ^5.5
This package is auto-updated.
Last update: 2024-11-17 00:54:52 UTC
README
Laravel Locale is a package that provide locale switcher for you application.
Installation
Install the package
composer require bramalho/laravel-locale
Add the service provider in config/app.php
BRamalho\LaravelLocale\LaravelLocaleServiceProvider::class,
Publish the configs
php artisan vendor:publish --provider 'BRamalho\LaravelLocale\LaravelLocaleServiceProvider'
Register the Middleware in app\Http\Kernel.php
<?php namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; use Bramalho\LaravelLocale\Http\Middleware\Locale; class Kernel extends HttpKernel { // ... protected $middleware = [ \Illuminate\Session\Middleware\StartSession::class, Locale::class ]; }
Usage
<form method="POST" action="{{ route('locale') }}"> @csrf <input type="text" name="locale" value="pt"> <button type="submit">Submit</button> </form>
License
The Laravel Locale is open-sourced software licensed under the MIT license.