gabrielandy/coindesk
A Laravel package for integrating the CoinDesk API into your PHP applications, providing convenient access to Bitcoin price index data and related market information through a simple, framework-friendly interface.
.env.1 are shown to 2 significant figures, while values at or above 1 keep 2 decimal places.// Exact method names depend on the package README.
$price = $coinDesk->price('BTC', 'USD');
$raw = $price->amount(); // keep numeric value for calculations
$display = $price->formatted(); // v1.2.0 formatting rules
Use the raw value for arithmetic, comparisons, and storage; use the formatted value only for display.
raw, currency, formatted, and fetchedAt fields prevents accidentally doing math on a display string.Http::fake() to return fixed CoinDesk responses, then assert both raw values and formatted output at boundary values.1: v1.2.0 switches rules at 1. Test values just below and above it, such as 0.999, 0.9999, 1.0, 1.001, and 1.005.0.999 formatted to 2 significant figures may become 1.0; confirm whether the formatter re-applies the “above 1” decimal-place rule or simply outputs the rounded significant-figure result.sprintf, number_format, or a decimal library, and each produces different trailing-zero behavior. Check the actual output for very small values such as 0.00001234.. as the decimal separator. If the UI needs comma separators or localized currency symbols, format after the package call or wrap it with NumberFormatter.php artisan config:clear during development.How can I help you explore Laravel packages today?