PHPackages                             sciphp/numphp - 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. sciphp/numphp

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

sciphp/numphp
=============

PHP library for scientific computing.

0.4.0(5y ago)6618.9k—2%5[1 issues](https://github.com/sciphp/numphp/issues)MITPHPPHP &gt;=7.2

Since Dec 12Pushed 2y ago4 watchersCompare

[ Source](https://github.com/sciphp/numphp)[ Packagist](https://packagist.org/packages/sciphp/numphp)[ Docs](https://github.com/sciphp/numphp)[ RSS](/packages/sciphp-numphp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

NumPhp [![Build Status](https://camo.githubusercontent.com/a13b2287685902d70aac3140cc0a81714dbbbc9d8d4a2aa39e782cd48e51e8fb/68747470733a2f2f7472617669732d63692e636f6d2f7363697068702f6e756d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/sciphp/numphp) [![Test Coverage](https://camo.githubusercontent.com/5202de717ba4354bcc52821c9a37f9785ca3688ef1dc709e7b6d323cc3faed97/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7363697068702f6e756d7068702f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/sciphp/numphp/coverage) [![Code Climate](https://camo.githubusercontent.com/e277ab95ba18b68b7588894ffe3735307d52a5f5aaee19913490e408587110d7/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7363697068702f6e756d7068702f6261646765732f6770612e737667)](https://codeclimate.com/github/sciphp/numphp)
=========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#numphp---)

NumPhp is a port of the famous NumPy (Python) package in PHP language.

- [Documentation](http://sciphp.org)
- [Code coverage](http://sciphp.org/coverage/)
- [API](http://sciphp.org/api/)

Table of contents
=================

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#install)
- [Basic Usage](#basic-usage)
- [Documentation](#documentation)
    - [NdArray attributes](#ndarray-attributes)
    - [NdArray methods](#ndarray-methods)
    - [NumPhp methods](#numphp-methods)
- [Contributing](#contributing)

---

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

[](#requirements)

NumPhp supports PHP 7.2, 7.3 7.4 and 8.0.

---

Install
-------

[](#install)

```
composer require sciphp/numphp

```

---

Basic usage
-----------

[](#basic-usage)

```
use SciPhp\NumPhp as np;

$m = np::ar(
  [[ 1, 0, 0],
   [ 0, 1, 0],
   [ 0, 0, 1]]
)->dot(42);

echo "m.42 =\n$m";
```

will output:

```
m.42 =
[[ 42,  0,  0 ],
 [  0, 42,  0 ],
 [  0,  0, 42 ]]

```

---

Documentation
-------------

[](#documentation)

### NdArray attributes

[](#ndarray-attributes)

- [NdArray::data](https://sciphp.org/manual/en/ndarray.data.html)
- [NdArray::ndim](https://sciphp.org/manual/en/ndarray.ndim.html)
- [NdArray::shape](https://sciphp.org/manual/en/ndarray.shape.html)
- [NdArray::size](https://sciphp.org/manual/en/ndarray.size.html)
- [NdArray::T](https://sciphp.org/manual/en/ndarray.T.html)

---

### NdArray methods

[](#ndarray-methods)

- [NdArray::copy](https://sciphp.org/manual/en/ndarray.copy.html)
- [NdArray::negative](https://sciphp.org/manual/en/ndarray.negative.html)
- [NdArray::ravel](https://sciphp.org/manual/en/ndarray.ravel.html)
- [NdArray::reshape](https://sciphp.org/manual/en/ndarray.reshape.html)
- [NdArray::resize](https://sciphp.org/manual/en/ndarray.resize.html)
- [NdArray::add](https://sciphp.org/manual/en/ndarray.add.html)
- [NdArray::divide](https://sciphp.org/manual/en/ndarray.divide.html)
- [NdArray::dot](https://sciphp.org/manual/en/ndarray.dot.html)
- [NdArray::multiply](https://sciphp.org/manual/en/ndarray.multiply.html)
- [NdArray::reciprocal](https://sciphp.org/manual/en/ndarray.reciprocal.html)
- [NdArray::subtract](https://sciphp.org/manual/en/ndarray.subtract.html)
- [NdArray::sum](https://sciphp.org/manual/en/ndarray.sum.html)
- [NdArray::trace](https://sciphp.org/manual/en/ndarray.trace.html)
- [NdArray::trapz](https://sciphp.org/manual/en/ndarray.trapz.html)
- [NdArray::log](https://sciphp.org/manual/en/ndarray.log.html)
- [NdArray::log10](https://sciphp.org/manual/en/ndarray.log10.html)
- [NdArray::log2](https://sciphp.org/manual/en/ndarray.log2.html)
- [NdArray::exp](https://sciphp.org/manual/en/ndarray.exp.html)
- [NdArray::expm1](https://sciphp.org/manual/en/ndarray.expm1.html)
- [NdArray::exp2](https://sciphp.org/manual/en/ndarray.exp2.html)
- [NdArray::power](https://sciphp.org/manual/en/ndarray.power.html)
- [NdArray::sqrt](https://sciphp.org/manual/en/ndarray.sqrt.html)
- [NdArray::square](https://sciphp.org/manual/en/ndarray.square.html)
- [NdArray::tril](https://sciphp.org/manual/en/ndarray.tril.html)
- [NdArray::triu](https://sciphp.org/manual/en/ndarray.triu.html)
- [NdArray::copysign](https://sciphp.org/manual/en/ndarray.copysign.html)
- [NdArray::signbit](https://sciphp.org/manual/en/ndarray.signbit.html)
- [NdArray::vander](https://sciphp.org/manual/en/ndarray.vander.html)
- [NdArray::is\_square](https://sciphp.org/manual/en/ndarray.is_square.html)

---

### NumPhp methods

[](#numphp-methods)

- [NumPhp::ar](https://sciphp.org/manual/en/numphp.ar.html)
- [NumPhp::full](https://sciphp.org/manual/en/numphp.full.html)
- [NumPhp::nulls](https://sciphp.org/manual/en/numphp.nulls.html)
- [NumPhp::ones](https://sciphp.org/manual/en/numphp.ones.html)
- [NumPhp::zeros](https://sciphp.org/manual/en/numphp.zeros.html)
- [NumPhp::full\_like](https://sciphp.org/manual/en/numphp.full_like.html)
- [NumPhp::nulls\_like](https://sciphp.org/manual/en/numphp.nulls_like.html)
- [NumPhp::zeros\_like](https://sciphp.org/manual/en/numphp.zeros_like.html)
- [NumPhp::arange](https://sciphp.org/manual/en/numphp.arange.html)
- [NumPhp::linspace](https://sciphp.org/manual/en/numphp.linspace.html)
- [NumPhp::logspace](https://sciphp.org/manual/en/numphp.logspace.html)
- [NumPhp::loadtxt](https://sciphp.org/manual/en/numphp.loadtxt.html)
- [NumPhp::diag](https://sciphp.org/manual/en/numphp.diag.html)
- [NumPhp::diagflat](https://sciphp.org/manual/en/numphp.diagflat.html)
- [NumPhp::diagonal](https://sciphp.org/manual/en/numphp.diagonal.html)
- [NumPhp::eye](https://sciphp.org/manual/en/numphp.eye.html)
- [NumPhp::negative](https://sciphp.org/manual/en/numphp.negative.html)
- [NumPhp::identity](https://sciphp.org/manual/en/numphp.identity.html)
- [NumPhp::trace](https://sciphp.org/manual/en/numphp.trace.html)
- [NumPhp::tri](https://sciphp.org/manual/en/numphp.tri.html)
- [NumPhp::tril](https://sciphp.org/manual/en/numphp.tril.html)
- [NumPhp::triu](https://sciphp.org/manual/en/numphp.triu.html)
- [NumPhp::vander](https://sciphp.org/manual/en/numphp.vander.html)
- [NumPhp::add](https://sciphp.org/manual/en/numphp.add.html)
- [NumPhp::divide](https://sciphp.org/manual/en/numphp.divide.html)
- [NumPhp::dot](https://sciphp.org/manual/en/numphp.dot.html)
- [NumPhp::multiply](https://sciphp.org/manual/en/numphp.multiply.html)
- [NumPhp::power](https://sciphp.org/manual/en/numphp.power.html)
- [NumPhp::sqrt](https://sciphp.org/manual/en/numphp.sqrt.html)
- [NumPhp::square](https://sciphp.org/manual/en/numphp.square.html)
- [NumPhp::reciprocal](https://sciphp.org/manual/en/numphp.reciprocal.html)
- [NumPhp::subtract](https://sciphp.org/manual/en/numphp.subtract.html)
- [NumPhp::transpose](https://sciphp.org/manual/en/numphp.transpose.html)
- [NumPhp::sum](https://sciphp.org/manual/en/numphp.sum.html)
- [NumPhp::trapz](https://sciphp.org/manual/en/numphp.trapz.html)
- [NumPhp::log](https://sciphp.org/manual/en/numphp.log.html)
- [NumPhp::log10](https://sciphp.org/manual/en/numphp.log10.html)
- [NumPhp::log2](https://sciphp.org/manual/en/numphp.log2.html)
- [NumPhp::exp](https://sciphp.org/manual/en/numphp.exp.html)
- [NumPhp::expm1](https://sciphp.org/manual/en/numphp.expm1.html)
- [NumPhp::exp2](https://sciphp.org/manual/en/numphp.exp2.html)
- [NumPhp::signbit](https://sciphp.org/manual/en/numphp.signbit.html)
- [NumPhp::copysign](https://sciphp.org/manual/en/numphp.copysign.html)
- [NumPhp::broadcast\_to](https://sciphp.org/manual/en/numphp.broadcast_to.html)
- [NumPhp::is\_square](https://sciphp.org/manual/en/numphp.is_square.html)

---

In the [complete documentation](http://sciphp.org), you will find all implemented stuff including some [Linear Algebra methods](https://sciphp.org/manual/en/ref.linalg.html)like [matrix norms](https://sciphp.org/manual/en/linalg.norm.html)and [Cholesky transformation](https://sciphp.org/manual/en/linalg.cholesky.html).

---

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

[](#contributing)

Feel free to open issues and make PR. Contributions are welcome.

If you find a mistake or think an example is missing in the documentation, it's hosted on [numphp-doc](https://github.com/sciphp/numphp-doc)repository.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community13

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.4% 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 ~336 days

Total

3

Last Release

2042d ago

PHP version history (2 changes)0.2.0PHP &gt;=5.6.0 || ^7.0

0.4.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/04ee1be59b281d31a2d48077a359052060f53baf7409cd1be97fe54ad4e7eb51?d=identicon)[landrok](/maintainers/landrok)

---

Top Contributors

[![landrok](https://avatars.githubusercontent.com/u/3310446?v=4)](https://github.com/landrok "landrok (122 commits)")[![lfr-dsto](https://avatars.githubusercontent.com/u/235840008?v=4)](https://github.com/lfr-dsto "lfr-dsto (2 commits)")

---

Tags

linear-algebramatrixndarraynumphpmatrixnumericlinear algebracomputingscientific

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sciphp-numphp/health.svg)

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

###  Alternatives

[markrogoyski/math-php

Math Library for PHP. Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra

2.4k7.1M40](/packages/markrogoyski-math-php)[markbaker/matrix

PHP Class for working with matrices

1.5k279.7M38](/packages/markbaker-matrix)[rubix/tensor

A library and extension that provides objects for scientific computing in PHP.

2751.4M5](/packages/rubix-tensor)[spicyweb/craft-neo

A Matrix-like field type with block hierarchy

395798.1k10](/packages/spicyweb-craft-neo)[numphp/numphp

Mathematical PHP library for scientific computing

144106.2k1](/packages/numphp-numphp)[mcordingley/linearalgebra

Matrix math for PHP.

85146.3k1](/packages/mcordingley-linearalgebra)

PHPackages © 2026

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