rinvex/languages
Laravel package to manage languages and locales in your app. Provides database-backed language records, ISO codes, and helpers for storing, retrieving, and listing available languages across projects, with seamless integration into the Rinvex ecosystem.
Language::get('en')).['name' => 'English', 'iso' => 'en-US', 'script' => 'Latn']), which can be:
User::morphTo() for multilingual profiles).en-GB vs. en-US).laravel-globals).laravel-localization or spatie/laravel-translatable).posts.languages) or kept as a reference table?zh vs. zh-CN)?config/app.php and publish config (if needed) via php artisan vendor:publish.Language facade for global access or inject the service into controllers/services.@language('en', 'name')) for templating./api/languages) for SPAs or mobile apps.users table has language_id).user_language_name, user_language_iso) for read performance.user.locale → Language::get($locale)->iso).if ($user->locale === 'es')) with package calls.user_locale column) in favor of the package’s data.laravel-ui, spatie/laravel-permission).app/Providers/LanguageServiceProvider.php.config/rinvex-languages.php.| Phase | Task | Dependencies |
|---|---|---|
| Setup | Install package, publish config, configure service provider. | None |
| Data Validation | Compare package data with a reference (e.g., ISO standards). | None |
| Backend | Inject Language service into controllers/services. |
Package installed |
| Database | Add language fields to relevant tables (e.g., users, posts). |
Schema migrations ready |
| Frontend | Update UI to display language metadata (e.g., flags, names). | Backend API endpoints available |
| Testing | Validate edge cases (e.g., invalid ISO codes, missing translations). | Full integration complete |
| Monitoring | Log data usage to identify gaps (e.g., unsupported languages). | Production deployment |
config/rinvex-languages.php for easy overrides.dd() or Log::debug() to inspect language objects.Cache::remember('languages', now()->addHours(1), function () {
return Language::all();
});
language-service).| Failure Scenario | Impact | Mitigation Strategy |
|---|---|---|
| Package data corruption | Incorrect language names/codes. | Maintain a backup dataset; validate on startup. |
| Cache invalidation issues | Stale language data. | Use cache tags or event-driven invalidation. |
| ISO code conflicts | Ambiguous language resolution. | Implement fallback logic (e.g., zh → zh-CN). |
| High memory usage | Slow responses. | Optimize caching; lazy-load language data. |
| Third-party API dependency | Future package abandonment. | Fork the repo or migrate to a maintained alternative. |
Language::get($code)->nameHow can I help you explore Laravel packages today?