PHPackages                             php-addons/bc-assert - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. php-addons/bc-assert

ActiveLibrary[Testing &amp; Quality](/categories/testing)

php-addons/bc-assert
====================

A wrapper around webmozart/assert that implements assertions with bcmath functions.

0.1.9(5y ago)0631MITPHPPHP ^7.3 || ^8.0

Since Sep 6Pushed 5y agoCompare

[ Source](https://github.com/php-addons/bc-assert)[ Packagist](https://packagist.org/packages/php-addons/bc-assert)[ Docs](https://github.com/php-addons/bc-assert)[ RSS](/packages/php-addons-bc-assert/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (11)Used By (0)

Bcmath Assert
=============

[](#bcmath-assert)

[![Build Status](https://camo.githubusercontent.com/50978bd5bd2f038d02b84e73bd261c2f182260d54d4eabfde0786b4e1c200f8b/68747470733a2f2f7472617669732d63692e6f72672f7068702d6164646f6e732f62632d6173736572742e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/github/php-addons/bc-assert)

A wrapper around [webmozart/assert](https://github.com/webmozart/assert) that implements assertions with [bcmath](https://www.php.net/manual/en/ref.bc.php) functions.

**Required PHP 7.3.0 or above.**

Installation
------------

[](#installation)

```
composer require php-addons/bc-assert
```

How to use
----------

[](#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
----------

[](#assertions)

The \[`Assert`\] class provides the following assertions:

### Comparison Assertions

[](#comparison-assertions)

MethodDescription`bcSame($value, $value2, $message = '', $scale = null)`Check that a value is identical to another (`bccomp($value, $value2, $scale) === 0`)`bcNotSame($value, $value2, $message = '', $scale = null)`Check that a value is not identical to another (`bccomp($value, $value2, $scale) !== 0`)`bcGreaterThan($value, $value2, $message = '', $scale = null)`Check that a value is greater than another`bcGreaterThanEq($value, $value2, $message = '', $scale = null)`Check that a value is greater than or equal to another`bcLessThan($value, $value2, $message = '', $scale = null)`Check that a value is less than another`bcLessThanEq($value, $value2, $message = '', $scale = null)`Check that a value is less than or equal to another`bcRange($value, $min, $max, $message = '', $scale = null)`Check that a value is within a range

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Recently: every ~15 days

Total

10

Last Release

2066d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25704924?v=4)[Vyacheslav Startsev](/maintainers/vyacheslav-startsev)[@vyacheslav-startsev](https://github.com/vyacheslav-startsev)

---

Top Contributors

[![vyacheslav-startsev](https://avatars.githubusercontent.com/u/25704924?v=4)](https://github.com/vyacheslav-startsev "vyacheslav-startsev (12 commits)")

---

Tags

assertbcmathwebmozart

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/php-addons-bc-assert/health.svg)

```
[![Health](https://phpackages.com/badges/php-addons-bc-assert/health.svg)](https://phpackages.com/packages/php-addons-bc-assert)
```

###  Alternatives

[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k28.9M2.3k](/packages/infection-infection)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k101.9M634](/packages/beberlei-assert)[phparkitect/phparkitect

Enforce architectural constraints in your PHP applications

9224.3M28](/packages/phparkitect-phparkitect)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69619.8M638](/packages/spatie-phpunit-snapshot-assertions)[symplify/phpstan-rules

Set of Symplify rules, type extensions and error formatter for PHPStan

26812.7M331](/packages/symplify-phpstan-rules)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

9410.7k](/packages/ahmed-bhs-doctrine-doctor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
