PHPackages                             prinsfrank/arithmetic-operations - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. prinsfrank/arithmetic-operations

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

prinsfrank/arithmetic-operations
================================

Interface for arithmetic operations implementation (addition, subtraction, power, dividing, etc...)

v0.1(3y ago)111.8k3MITPHPPHP ^8.0

Since Oct 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/PrinsFrank/arithmetic-operations)[ Packagist](https://packagist.org/packages/prinsfrank/arithmetic-operations)[ RSS](/packages/prinsfrank-arithmetic-operations/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (3)

Arithmetic Operations
=====================

[](#arithmetic-operations)

This is an abstraction package including an interface for arithmetic operations, that can be implemented in 'implementation' packages.

Building your own implementation
--------------------------------

[](#building-your-own-implementation)

If you want to contribute an implementation of the arithmetic-operations, you can easily do so. If you want to implement the interface in the package, you need to depend on the package itself by adding it to the 'require' section;

```
composer require prinsfrank/arithmetic-operations
```

After that, you want to make sure that packagist understands that you are implementing the Virtual Package 'prinsfrank/arithmetic-operations-implementation' and listing the package under the Virtual Package. You can do so, by adding the package to the 'provides' section. After pushing the package to packagist it should appear under the [Virtual Package here](https://packagist.org/providers/prinsfrank/arithmetic-operations-implementation)

Adding a dependency to an implementation to your composer package
-----------------------------------------------------------------

[](#adding-a-dependency-to-an-implementation-to-your-composer-package)

When you as a package maintainer want to let people choose between different arithmetic operation implementations, you can require 'prinsfrank/arithmetic-operations-implementation' as a dependency. Note the '-implementation' on the end. This is a so called 'virtual package'.

If you added a direct dependency to the 'prinsfrank/arithmetic-operations' package, this would result in only the interface being installed. Instead, making use of the Virtual Package prompts the developer to choose an implementation.

Virtual packages are listed on packagist as [a list of their implementations](https://packagist.org/providers/prinsfrank/arithmetic-operations-implementation).

Installing an implementation when it is required by a package
-------------------------------------------------------------

[](#installing-an-implementation-when-it-is-required-by-a-package)

When installing a package that requires an implementation of this package, composer will give an error and a choice here. For example, when requiring the package prinsfrank/measurement-unit with the following command:

```
composer require prinsfrank/measurement-unit
```

Without first installing an implementation of this package, the following error will be shown:

```
In PackageDiscoveryTrait.php line 379:
  Could not find a matching version of package prinsfrank/measurement-unit. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (stable).
    - prinsfrank/measurement-unit v0.1 requires prinsfrank/arithmetic-operations-implementation ^0.1 -> could not be found in any version, but the following packages provide it:
      - prinsfrank/arithmetic-operations-bcmath BCMath implementation for the prinsfrank/arithmetic-operations interface that provides basic arithme
      - prinsfrank/arithmetic-operations-floating-point Floating point math implementation for the prinsfrank/arithmetic-operations interface that provides
      Consider requiring one of these to satisfy the prinsfrank/arithmetic-operations-implementation requirement.

```

To fix this, choose one of the suggested packages, and require the package you want to add as follows, where you require both packages at the same time:

```
composer require prinsfrank/measurement-unit prinsfrank/arithmetic-operations-floating-point
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

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

Unknown

Total

1

Last Release

1301d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/288919c24dc651727390578a2bfe6ef020f6f508c30db717b54c943a9e2ac0b3?d=identicon)[PrinsFrank](/maintainers/PrinsFrank)

---

Top Contributors

[![PrinsFrank](https://avatars.githubusercontent.com/u/25006490?v=4)](https://github.com/PrinsFrank "PrinsFrank (8 commits)")

---

Tags

interface

### Embed Badge

![Health badge](/badges/prinsfrank-arithmetic-operations/health.svg)

```
[![Health](https://phpackages.com/badges/prinsfrank-arithmetic-operations/health.svg)](https://phpackages.com/packages/prinsfrank-arithmetic-operations)
```

PHPackages © 2026

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