php-addons / bc-assert
A wrapper around webmozart/assert that implements assertions with bcmath functions.
0.1.9
2020-11-04 17:29 UTC
Requires
- php: ^7.3 || ^8.0
- ext-bcmath: *
- webmozart/assert: ^1
Requires (Dev)
- phpunit/phpunit: ^6.0 || ^7.0 || ^8.0 || ^9.0
- roave/security-advisories: dev-master
README
A wrapper around webmozart/assert that implements assertions with bcmath functions.
Required PHP 7.3.0 or above.
Installation
composer require php-addons/bc-assert
How to use
use PhpAddons\BcAssert\Assert; class Money { public function __construct(string $value) { Assert::bcGreaterThan($value, '0', 'The money must be a positive number. Got: %s', 2); } }
If the last parameter ($scale
) is not set, the default scale from the system will be used.
Assertions
The [Assert
] class provides the following assertions: