PHPackages                             zazalt/calculus - 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. zazalt/calculus

ActiveLibrary

zazalt/calculus
===============

Calculus

263PHP

Since Feb 23Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Zazalt/Calculus)[ Packagist](https://packagist.org/packages/zazalt/calculus)[ RSS](/packages/zazalt-calculus/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Calculus
========

[](#calculus)

[![Build Status](https://camo.githubusercontent.com/23fab99a8ac1cf36c0034ce57323bd20f7d9ddbe300aa8fecd63e55e502568df/68747470733a2f2f7472617669732d63692e6f72672f5a617a616c742f43616c63756c75732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Zazalt/Calculus)[![Coverage Status](https://camo.githubusercontent.com/d0e9e48821a74882ba240e19b2b1aaa417f2293c830f7aa152e72794d06d6d4f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f5a617a616c742f43616c63756c75732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Zazalt/Calculus?branch=master)[![Code Climate](https://camo.githubusercontent.com/c80b181cc1f83abf29cb0e89a7b06fe3fcfdb03c672080cce28e8ddf994fed00/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f5a617a616c742f43616c63756c75732f6261646765732f6770612e737667)](https://codeclimate.com/github/Zazalt/Calculus)[![Issue Count](https://camo.githubusercontent.com/7658c89d9e89907b5f341fc9963a841aca3588f08bcee040743206262d42cd1f/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f5a617a616c742f43616c63756c75732f6261646765732f69737375655f636f756e742e737667)](https://codeclimate.com/github/Zazalt/Calculus/issues)[![Total Downloads](https://camo.githubusercontent.com/2dc6015d28112ba7b3554c6232ed4ea2275cf5f987afb15dafb14c1cbc4804ca/68747470733a2f2f706f7365722e707567782e6f72672f7a617a616c742f63616c63756c75732f646f776e6c6f616473)](https://packagist.org/packages/zazalt/calculus/stats)[![Latest Stable Version](https://camo.githubusercontent.com/b8c3d2901896c70be062b4d0a42894ac50d98932f4947cbef93275df773d9efa/68747470733a2f2f706f7365722e707567782e6f72672f7a617a616c742f63616c63756c75732f762f737461626c65)](https://packagist.org/packages/zazalt/calculus)[![Version](https://camo.githubusercontent.com/acca41dd3b978af99b06f7de6b2765ec07484cb08a028738a88244acada72cad/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d626574612d79656c6c6f772e737667)](https://camo.githubusercontent.com/acca41dd3b978af99b06f7de6b2765ec07484cb08a028738a88244acada72cad/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d626574612d79656c6c6f772e737667)

Calculus is a PHP library for mathematics/2D/3D computing

Requirements
------------

[](#requirements)

- php &gt;= 7.1.0

Packagist Dependencies
----------------------

[](#packagist-dependencies)

- None

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

[](#installation)

With composer:

```
{
	"require": {
		"zazalt/calculus": "dev-master"
	}
}
```

Usage
-----

[](#usage)

```
$Calculus = new Zazalt\Calculus\Calculus();

/**
 * Check if a nunmber is prime based on trial division
 *
 * @return  boolean
 */
$Calculus->isPrimeNumber($number);

/**
 * Calculating distance between two points on a flat plane
 *
 * @return  integer
 */
$Calculus->distanceBetweenTwoPoints($pointA = [], $pointB = []);

/**
 * Resize a rectangle object until it falls in desired dimension, but keep aspect ratio
 * A usefull function/method when want to resize an image
 *
 * @return  array
 */
$Calculus->resizeRectangle($rectangleDimensions = [], $rectangleNewDimensions = []);

/**
 * Not implemented/documented, yet!
 */
$Calculus->mean();

/**
 * Not implemented/documented, yet!
 */
$Calculus->median();

/**
 * Not implemented/documented, yet!
 */
$Calculus->mode();
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/22763a2750fcb94bfd6e807d1c0ba1bae6439cb7bb3056816aa096807b3d8255?d=identicon)[Zazalt](/maintainers/Zazalt)

---

Top Contributors

[![Zazalt](https://avatars.githubusercontent.com/u/19550851?v=4)](https://github.com/Zazalt "Zazalt (24 commits)")

---

Tags

calculatorcalculusnumbersphpphp-libraryphp7php71

### Embed Badge

![Health badge](/badges/zazalt-calculus/health.svg)

```
[![Health](https://phpackages.com/badges/zazalt-calculus/health.svg)](https://phpackages.com/packages/zazalt-calculus)
```

PHPackages © 2026

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