PHPackages                             etconsilium/php-complex-number - 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. etconsilium/php-complex-number

ActivePackage

etconsilium/php-complex-number
==============================

Classes that define complex numbers and their operations (PEAR::Math\_Complex cover ft. PHP7)

01PHP

Since Feb 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/etconsilium/php-complex-number)[ Packagist](https://packagist.org/packages/etconsilium/php-complex-number)[ RSS](/packages/etconsilium-php-complex-number/feed)WikiDiscussions main Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Complex numbers
===============

[](#complex-numbers)

##### Classes that define complex numbers and their operations, based on PEAR::Math\_Complex

[](#classes-that-define-complex-numbers-and-their-operations-based-on-pearmath_complex)

---

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

[](#how-to-use)

### Imperative Procedural Approach

[](#imperative-procedural-approach)

```
use Math\Complex;
use Math\Complex\Operation;

$a = complex(0.3, 0.5);
$b = complex(1.0, -M_PI_2);

echo "a = " . $a->toString() . PHP_EOL;
echo "b = " . $b->toString() . PHP_EOL;
$z = Complex\sqrt($a);          //  namespace
echo "sqrt(a) = " . $z->toString() . PHP_EOL;
$z = Operation::log10($b);      //  or static call
echo "log10(a) = " . $z->toString() . PHP_EOL;

$z = Operation::add($a, $b);
echo "add(a, b) = " . $z->toString() . PHP_EOL;
$z = Complex\div($a, $b);
echo "div(a, b) = " . $z->toString() . PHP_EOL;
```

@see also [using\_example.php](./using_example.php)

### Object Oriented Approach

[](#object-oriented-approach)

```
use Math\Complex;
use Math\Complex\Operation;

$a = Complex::new(0.3, 0.5);    //  factory method contains syntactic sugar
$b = new Complex(["real" => 1, "imaginary" => -M_PI_2]); //  constructor does not

$op = new Operation($a);        //  operands' FILO inside the class
//  Operation::add($a, $b);
$c = $op->add($b)->fetch();     //  first Complex element shift from heap's top and return
print $c->asString() . PHP_EOL;

print $op->mul($c,$a)() . PHP_EOL;  //  php double magic: __call alias fetch() & __toString

print $op->atan(complex(1,2))
	->mul(complex(3,4))         //  can be chained
	->add(complex(5,6))
	->abs();
```

#### Enjoy!

[](#enjoy)

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 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/834b0bab4f3d2068b5575aea761fb012ea3baccee2db973be9bcf12cde3c3ebb?d=identicon)[etconsilium](/maintainers/etconsilium)

---

Top Contributors

[![etconsilium](https://avatars.githubusercontent.com/u/2026534?v=4)](https://github.com/etconsilium "etconsilium (5 commits)")

### Embed Badge

![Health badge](/badges/etconsilium-php-complex-number/health.svg)

```
[![Health](https://phpackages.com/badges/etconsilium-php-complex-number/health.svg)](https://phpackages.com/packages/etconsilium-php-complex-number)
```

PHPackages © 2026

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