The Laravel Languages package provides a ready-to-use list of languages for your Laravel application. This package simplifies the task of managing languages across your app, allowing you to easily retrieve language codes (alpha-2, alpha-3) and names for a variety of purposes like localization, language selection in forms, or general language-related data management.
- Install
composer require dazza-dev/laravel-languages
- Publish migrations and seeders
php artisan vendor:publish --tag="laravel-languages"
- Run migrations and seeders
php artisan migrate
php artisan db:seed --class=LanguagesSeeder
- Get all Languages
use DazzaDev\Languages\Facades\Languages;
Languages::all();
- Get only active languages
use DazzaDev\Languages\Facades\Languages;
Languages::active();
- Get language by code
use DazzaDev\Languages\Facades\Languages;
Languages::getByCode('en'); // Returns English
Languages::getByCode('eng'); // Also returns English
- Activate language by code or name
use DazzaDev\Languages\Facades\Languages;
Languages::activate('en');
Languages::activate('eng');
- Deactivate language by code or name
use DazzaDev\Languages\Facades\Languages;
Languages::deactivate('en');
Languages::deactivate('eng');
Contributions are welcome. If you find any bugs or have ideas for improvements, please open an issue or send a pull request. Make sure to follow the contribution guidelines.
Laravel Languages was created by DAZZA.
This project is licensed under the MIT License.