- How do I install andrey-helldar/cashier in Laravel?
- Install it with Composer using composer require andrey-helldar/cashier. The package is a Laravel-oriented currency component, so you can then use its API directly in controllers, services, or Blade views. Check the README for any service provider or config publishing steps required by your Laravel version.
- What Laravel versions does andrey-helldar/cashier support?
- Laravel version support is defined by the package's Composer constraints rather than a single fixed version. Check the require section on Packagist or in the README before installing. If you are on an older Laravel release, verify compatibility with the Cashbox foundation dependency.
- How do I format currency amounts with symbols and separators?
- Use the package's formatting API to pass an amount and a currency code, and it applies the correct symbol, decimal places, and separators. You can typically configure defaults globally and override them per call. This keeps display formatting consistent across your Laravel application.
- How do I convert between currencies with Cashier?
- Cashier provides currency conversion through its configurable API, using the exchange-rate data configured for your application. You pass the source and target currencies and format the result as needed. For production, make sure your rates are refreshed from a reliable source.
- How do I configure default currency and formatting options?
- Configuration is handled through the package config, where you can set defaults such as currency, formatting style, and separators. Publish the config file if the README instructs you to, then adjust values per environment. You can also override settings at call time for specific screens or reports.
- Can I access currency data such as symbols, decimals, and exchange rates?
- Yes. The package exposes currency data such as codes, symbols, decimals, and related formatting metadata through a simple API. That lets you build selectors, invoices, and price displays without hard-coding currency details. Exchange-rate availability depends on the data you configure.
- Is andrey-helldar/cashier localization-friendly?
- Yes, it is designed to be localization-friendly by separating currency formatting from application logic. You can format amounts with locale-appropriate symbols and separators and override defaults per currency. For full localization, combine it with Laravel's translation and locale handling.
- How do I test currency formatting and conversion in a Laravel app?
- In tests, assert that amounts format with the expected symbol, decimals, and separators for each configured currency. Also test conversion results with fixed exchange rates so assertions are deterministic. Use Laravel's testing helpers and avoid live rate calls in unit tests.
- Is andrey-helldar/cashier suitable for production and how is it maintained?
- It is lightweight and suitable for production use in Laravel apps that need currency formatting and conversion. Because it is a subtree split of the Cashbox component, maintenance and fixes flow from cashbox/foundation. Review the repository and release history before relying on it for critical billing logic.
- What is the difference between andrey-helldar/cashier and cashbox/foundation?
- andrey-helldar/cashier is a read-only subtree split of the Cashbox component, while cashbox/foundation is the underlying foundation package. Install cashier when you want the Laravel-facing currency API; use foundation directly if you are building within the Cashbox ecosystem. Avoid editing the split repository because changes should be made upstream.