moneyphp/iso-currencies
Provides an up-to-date ISO 4217 currency list sourced from the official ISO Maintenance Agency (currency-iso.org). Designed primarily for moneyphp/money, with composer commands to install and fetch updates for currency data.
Laravel/PHP Stack Alignment:
The package is highly compatible with Laravel’s architecture due to its Composer-based dependency model and minimalist design. It can be seamlessly integrated via Laravel’s service container (e.g., binding CurrencyRepository as a singleton in AppServiceProvider) or leveraged by Laravel packages like laravel-money. The static data structure (ISO 4217 metadata) ensures zero runtime overhead, making it ideal for performance-sensitive applications (e.g., payment gateways, financial APIs). The historical currency flag (e.g., BGN post-2026) aligns with Laravel’s need for data consistency across microservices or monolithic apps.
Integration Feasibility:
moneyphp/money, enabling plug-and-play integration with Laravel applications using this library. For example, replacing hardcoded currency arrays with CurrencyRepository::getAll() reduces technical debt and ensures ISO compliance.moneyphp/money. However, this requires additional abstraction (e.g., a facade or service layer) to decouple it from MoneyPHP-specific logic.Technical Risk:
Currency entity structure) may conflict with alternative libraries (e.g., league/money). Mitigation: Use a wrapper service to normalize currency data for non-MoneyPHP use cases.composer fetch-update), which may not suit applications needing real-time sync. Mitigation: Schedule updates via CI/CD pipelines (e.g., weekly) or supplement with a cache layer.entities removal) risk unexpected failures if versions aren’t pinned. Mitigation: Lock versions in composer.json (e.g., ^3.8) and test upgrades in staging.Key Questions:
moneyphp/money?
fetch-update) be automated?
Laravel Compatibility: The package integrates natively with Laravel’s Composer workflow, service container, and dependency injection. Key integration points:
CurrencyRepository as a singleton in AppServiceProvider:
$this->app->singleton(CurrencyRepository::class, function ($app) {
return new CurrencyRepository();
});
Currency) to simplify access:
use Illuminate\Support\Facades\Facade;
class Currency extends Facade {
protected static function getFacadeAccessor() { return 'currency'; }
}
laravel-money, the package automatically aligns with its currency resolution logic.use Illuminate\Validation\Rule;
Rule::macro('valid_currency', function ($attribute, $value, $parameters) {
return CurrencyRepository::getInstance()->hasCurrency($value);
});
Symfony Compatibility:
The package supports Symfony 5–8 via symfony/yaml and can be integrated into Symfony’s dependency injection system. For Laravel, this is not directly relevant unless using Symfony components (e.g., HttpKernel).
Assessment Phase:
Pilot Integration:
composer require moneyphp/iso-currencies
composer fetch-update
CurrencyRepository.Full Rollout:
Automation:
- name: Update currencies
run: composer fetch-update
^3.4.Phase 1: Core Integration
CurrencyRepository to Laravel’s container.CurrencyRepository::getAll().Phase 2: Compliance & Legacy Support
string (not enum).Phase 3: Full Adoption
Phase 4: Optimization
composer fetch-update.fetch-update must be scheduled (e.g., monthly) to avoid stale data.How can I help you explore Laravel packages today?