Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Bcmath Cast

Laravel Bcmath Cast Laravel Package

yuwuhsien/laravel-bcmath-cast

Laravel Eloquent casts for PHP 8.4's BCMath\Number object, turning model attributes into arbitrary-precision decimals so you can use natural operators like +, -, and * directly while keeping money math exact. Requires PHP 8.4+ and Laravel 12+.

View on GitHub
Deep Wiki
Context7

Laravel BCMath Cast integrates Eloquent with PHP 8.4's BCMath\Number object API, so model attributes become arbitrary-precision decimal objects. Use the AsDecimal cast to perform natural operator-based arithmetic—like $product->price - $product->cost—directly on attributes while preserving decimal accuracy.

  • Converts attributes to BCMath\Number instances automatically
  • Supports numeric strings, integers, floats, and Number inputs
  • Enables precise arithmetic with standard operators
  • Seamless Eloquent casting for decimal-heavy models
  • Requires PHP 8.4+ and Laravel 12+
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console