PHPackages                             alemian95/php-complex-numbers - 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. alemian95/php-complex-numbers

ActiveLibrary

alemian95/php-complex-numbers
=============================

Package for manipulating and performing calculations with complex numbers

v1.0.1(1y ago)08MITPHP

Since May 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/alemian95/php-complex-numbers)[ Packagist](https://packagist.org/packages/alemian95/php-complex-numbers)[ RSS](/packages/alemian95-php-complex-numbers/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

PHP Complex numbers
===================

[](#php-complex-numbers)

Introduction
------------

[](#introduction)

This library provides a simple way to manipulate and perform calculations with complex numbers.

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

[](#installation)

You can install this library via Composer

```
composer require alemian95/php-complex-numbers
```

Usage
-----

[](#usage)

### Creating Complex Numbers

[](#creating-complex-numbers)

You can create a complex number using either Cartesian coordinates (real and imaginary parts) or polar coordinates (magnitude and argument)

```
use Alemian95\PhpComplexNumbers\Complex;

// Create a complex number using Cartesian coordinates
$complex1 = new Complex(3.0, 4.0);

// Create a complex number using polar coordinates
$complex2 = Complex::createFromPolar(5.0, 0.92729521800161); // Equivalent to (3, 4)
```

### Basic Operations

[](#basic-operations)

You can perform basic arithmetic operations on complex numbers, such as addition, subtraction, multiplication, and division:

```
// Addition
$sum = $complex1->add($complex2);

// Subtraction
$diff = $complex1->sub($complex2);

// Multiplication
$product = $complex1->mul($complex2);

// Division
$quotient = $complex1->div($complex2);
```

### Other operations

[](#other-operations)

You can also perform other operations such as calculating the absolute value, argument, and conjugate of a complex number:

```
// Absolute value
$absoluteValue = $complex1->abs();

// Argument
$argument = $complex1->arg();

// Conjugate
$conjugate = $complex1->conjugate();
```

Contributing
------------

[](#contributing)

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on GitHub.

License
-------

[](#license)

This library is licensed under the MIT License.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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 ~0 days

Total

2

Last Release

729d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/08dbb2e514254cd520704bba64bb56f1387105a0e009c40f2aa8bbbe7fd2a40a?d=identicon)[alemian95](/maintainers/alemian95)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alemian95-php-complex-numbers/health.svg)

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

PHPackages © 2026

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