umpirsky/currency-list
Provides up-to-date lists of world currencies for PHP apps, extracted from CLDR. Includes currency codes, names and symbols in many locales, easy to install via Composer and use for dropdowns, validation, and formatting.
CurrencyService) to abstract data access. Follows the Single Responsibility Principle by isolating currency logic.Currency as a model with relationships (e.g., Order::morphToMany(Currency::class))./api/currencies/{locale}).CurrencySeeder).composer require umpirsky/currency-list:^2.0).CurrencyList::make()) or facades (Currency::all('en')).@currency('EUR') for templates.currencies table with columns: code, name, symbol, locale, and updated_at.php artisan db:seed --class=CurrencySeeder).cache()->remember('currencies_en', 30, fn() => CurrencyList::get('en'))).composer require umpirsky/currency-list).CurrencyList::get('en') in a Tinker session).CurrencyService to wrap the package (e.g., add validation, logging).config/currency.php) for locale defaults.| Step | Task | Dependencies |
|---|---|---|
| 1 | Install package | None |
| 2 | Create CurrencyService |
Package installed |
| 3 | Publish config | Service created |
| 4 | Run database migration | Config published |
| 5 | Seed initial data | Migration complete |
| 6 | Implement caching | Data seeded |
| 7 | Add API endpoints | Service + caching |
| 8 | Automate updates | API endpoints tested |
| 9 | Extend for business rules | Core integration done |
composer update and re-run seeder (low risk, but prone to human error).php artisan currency:update).composer.json (e.g., ^2.0) unless critical features are needed.supportedLocales config includes the needed language.get('en') instead of get()).updated_at is handled during manual updates.Log::debug('Currencies:', CurrencyList::get('fr'))).dd() in middleware to inspect locale resolution.code and locale columns.CurrencyList::get(app()->getLocale())).app()->setLocale() based on user preferences.supportedLocales with fallbacks (e.g., ['fr' => 'en']).| Risk | Impact | Mitigation |
|---|---|---|
| Stale Data | Incorrect currency names/symbols in production. | Automated version checks + manual review before updates. |
| Locale Mismatch | User sees wrong currency name/symbol. | Validate locale against supportedLocales in middleware. |
| DB Corruption | Seeder fails, breaking currency references. | Backup DB before updates; use transactions in migrations. |
| **Caching |
How can I help you explore Laravel packages today?