Download the PHP package centralbank/exchangerates without Composer
On this page you can find all versions of the php package centralbank/exchangerates. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download centralbank/exchangerates
More information about centralbank/exchangerates
Files in centralbank/exchangerates
Package exchangerates
Short Description Modified Central Bank of Myanmar Exchange Rates API Laravel Package
License MIT
Informations about the package exchangerates
Central Bank of Myanmar Exchange Rates API for Laravel
SaveMyanmar
Enhanced Central Bank of Myanmar Exchange Rates Laravel Package with caching, error handling, and service-based architecture.
Version - 2.0.0
Contact me - [email protected]
Buy me a coffee - KBZ Pay (Hein Thu Ya) - 09978966317
Features
- ✅ Service-Based Architecture - Clean service class for easy integration
- ✅ Caching Support - Reduces API calls with configurable cache duration
- ✅ Error Handling - Robust error handling and validation
- ✅ Dynamic Currency Support - Automatically supports all CBM currencies
- ✅ Cache Management - Manual cache refresh capability
- ✅ Environment Configuration - Configurable via environment variables
- ✅ Dependency Injection - Proper Laravel service container integration
Requirements
- PHP 7.4 or Higher
- Laravel 8.0 or Higher (supports Laravel 8.x, 9.x, 10.x, 11.x)
Installation
Auto-Discovery
Laravel will automatically discover the service provider. No manual registration needed.
Manual Registration (Optional)
If auto-discovery is disabled, add the ServiceProvider in config/app.php
:
Publish Configuration
This creates config/exchangerates-api.php
for customization.
Configuration
The package can be configured via environment variables:
Usage Examples
Using the Service Class
In Controllers
In Artisan Commands
Using Facades (Optional)
You can create your own facade or use dependency injection as shown above.
Service Methods
getAllRates()
Returns all available exchange rates with caching.
getRate(string $currencyCode)
Returns exchange rate for a specific currency (e.g., 'USD', 'EUR').
getRates(array $currencyCodes)
Returns exchange rates for multiple currencies.
refreshCache()
Clears cache and fetches fresh data from CBM API.
clearCache()
Clears the cached exchange rates.
Response Format
All Rates Response
Single Currency Response
Changelog
v2.0.0
- Removed all API routes and endpoints
- Implemented comprehensive error handling
- Added support for specific currency queries
- Added multiple currency endpoint
- Added cache refresh functionality
- Dynamic currency support (no hardcoded currencies)
- Environment-based configuration
- Converted to service-only architecture
- Package now provides only the ExchangeRateService class
- Developers must create their own controllers/routes if needed
- Cleaner, more flexible integration approach
- Added proper dependency injection
- Enhanced documentation
v1.0.0
- Initial release with basic functionality