https://github.com/arispati/app-locale
Localization for Laravel and Lumen Framework
https://github.com/arispati/app-locale
laravel localization lumen
Last synced: 2 months ago
JSON representation
Localization for Laravel and Lumen Framework
- Host: GitHub
- URL: https://github.com/arispati/app-locale
- Owner: arispati
- Created: 2021-08-06T09:48:27.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-06T09:54:35.000Z (almost 5 years ago)
- Last Synced: 2025-10-30T06:45:46.173Z (8 months ago)
- Topics: laravel, localization, lumen
- Language: PHP
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# App Locale
Localization for Laravel and Lumen Framework
## Description
This package will set the locale of the application by the request that contains the `App-Locale` attribute in the header
## How to Install
- Install with composer
```bash
composer require arispati/app-locale
```
### Laravel
- Register the middleware
```php
// app/Http/Kernel.php
protected $middleware = [
// ...
\Arispati\AppLocale\Middleware\AppLocale::class
];
```
### Lumen
- Register the middleware
```php
// bootstrap/app.php
$app->middleware([
\Arispati\AppLocale\Middleware\AppLocale::class
]);
```
- if you want to use `Facade`
```php
// bootstrap/app.php
// Enabled Facade
$app->withFacades(true, [
'\Arispati\AppLocale\Facades\AppLocale' => 'AppLocale'
]);
// Register service provider
$app->register(\Arispati\AppLocale\ServiceProvider::class);
```
## Available Method
- Set app locale
```php
AppLocale::setLocale('id'); // set app locale to 'id' (Bahasa Indonesia)
```
- Get app locale
```php
AppLocale::getLocale();
```