Skip to content

The Laravel Languages package provides a ready-to-use list of languages for your Laravel application.

Notifications You must be signed in to change notification settings

dazza-dev/Laravel-Languages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Languages

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.

Setup

  • 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

Usage

  • 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

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.

Author

Laravel Languages was created by DAZZA.

License

This project is licensed under the MIT License.

About

The Laravel Languages package provides a ready-to-use list of languages for your Laravel application.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages