PHPackages                             scienide/tensor - 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. scienide/tensor

Abandoned → [rubix/tensor](/?search=rubix%2Ftensor)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

scienide/tensor
===============

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

3.0.1(4y ago)49.9k1MITPHPPHP &gt;=7.4

Since Oct 14Pushed 4y ago2 watchersCompare

[ Source](https://github.com/Scien-ide/Tensor)[ Packagist](https://packagist.org/packages/scienide/tensor)[ Docs](https://github.com/Scien-ide/Tensor)[ GitHub Sponsors](https://github.com/RubixML)[ GitHub Sponsors](https://github.com/andrewdalpino)[ RSS](/packages/scienide-tensor/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (7)Versions (27)Used By (0)

Tensor: Scientific Computing for PHP
====================================

[](#tensor-scientific-computing-for-php)

[![PHP from Packagist](https://camo.githubusercontent.com/55eef0506205d3839f716c9241c275335b11f129b883977e0086a03455a3a012/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f72756269782f74656e736f722e7376673f7374796c653d666c617426636f6c6f72423d383839324246)](https://www.php.net/) [![Latest Stable Version](https://camo.githubusercontent.com/f57edca2f8562437098c7e47c93382cf97fa5242f0ae4a5602925e802ffc2631/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72756269782f74656e736f722e7376673f7374796c653d666c617426636f6c6f72423d6f72616e6765)](https://packagist.org/packages/rubix/tensor) [![Build](https://github.com/RubixML/Tensor/workflows/Build/badge.svg)](https://github.com/RubixML/Tensor/actions) [![Compile extension](https://github.com/RubixML/Tensor/actions/workflows/ci-ext.yml/badge.svg)](https://github.com/RubixML/Tensor/actions/workflows/ci-ext.yml) [![Downloads from Packagist](https://camo.githubusercontent.com/d88705bb5d8dba934bfab7d1228f324480d0189fe54af814faf160a587fa97d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72756269782f74656e736f722e7376673f7374796c653d666c617426636f6c6f72423d726564)](https://packagist.org/packages/rubix/tensor) [![GitHub](https://camo.githubusercontent.com/504a651a14c406b2cfa1da90c04020842cc7990a3055c8eb657f9f88d52765ed/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f52756269784d4c2f54656e736f72)](https://github.com/RubixML/Tensor/blob/master/LICENSE.md)

Tensor is a library and extension that provides objects for scientific computing in [PHP](https://php.net). The multithreaded extension is especially suited for computing large sets of numbers. In some cases, the extension is 230X faster than the same operation in PHPland. Tensor is used by libraries such as [Rubix ML](https://rubixml.com) to build and accelerate machine learning algorithms such as linear regression, dimensionality reduction, and neural networks.

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

[](#installation)

Follow the instructions below to install either Tensor PHP or the Tensor extension.

### Tensor PHP

[](#tensor-php)

Install Tensor PHP into your project with [Composer](https://getcomposer.org/):

```
$ composer require scienide/tensor
```

### Tensor Extension

[](#tensor-extension)

Install the Tensor extension via [PECL](https://pecl.php.net/package/Tensor):

```
$ pecl install tensor
```

> **Note:** If both the library and extension are installed, the extension will take precedence.

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

[](#requirements)

- [PHP](https://php.net) 7.4 or above

### Optional To Compile Extension

[](#optional-to-compile-extension)

- A C compiler such as [GCC](https://gcc.gnu.org/), [Clang](https://clang.llvm.org/), or [Visual C++](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
- A Fortran compiler such as [GFortran](https://gcc.gnu.org/wiki/GFortran)
- The PHP development package (source code and tooling)
- [OpenBLAS](https://www.openblas.net/) development package
- [LAPACKE](https://www.netlib.org/lapack/lapacke.html) development package
- [GNU make](https://www.gnu.org/software/make/) 3.81 or later
- [autoconf](https://www.gnu.org/software/autoconf/autoconf.html) 2.31 or later
- [automake](https://www.gnu.org/software/automake/) 1.14 or later
- Ubuntu build-essentials

Manually Compiling the Extension
--------------------------------

[](#manually-compiling-the-extension)

Clone the repository locally using [Git](https://git-scm.com/):

```
$ git clone https://github.com/Scien-ide/Tensor
```

Make sure you have all the necessary build tools installed such as a C compiler and make tools. For example, on an Ubuntu linux system you can enter the following on the command line to install the necessary dependencies.

```
$ sudo apt-get install make gcc gfortran php-dev libopenblas-dev liblapacke-dev re2c build-essential
```

Then, change into the `ext` directory from the project root and run the following commands from the terminal. See [this guide](https://www.php.net/manual/en/install.pecl.phpize.php) for more information on compiling PHP extensions with PHPize.

```
$ cd ./ext
$ phpize
$ ./configure
$ make
$ sudo make install
```

Finally, add the following line to your `php.ini` configuration to install the extension.

```
extension=tensor.so

```

To confirm that the extension is loaded in PHP, you can run the following command.

```
php -m | grep tensor
```

Performance Comparison
----------------------

[](#performance-comparison)

[![Tensor Performance MNIST](https://raw.githubusercontent.com/Scien-ide/Tensor/master/docs/images/tensor-performance-mnist.png)](https://raw.githubusercontent.com/Scien-ide/Tensor/master/docs/images/tensor-performance-mnist.png)

[![Tensor Performance Benchmarks](https://raw.githubusercontent.com/Scien-ide/Tensor/master/docs/images/tensor-performance-benchmarks.png)](https://raw.githubusercontent.com/Scien-ide/Tensor/master/docs/images/tensor-performance-benchmarks.png)

Funding
-------

[](#funding)

Tensor is funded by donations from the community. You can become a sponsor by making a contribution to one of our funding sources below.

- [Github Sponsors](https://github.com/sponsors/RubixML)

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

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

License
-------

[](#license)

The code is licensed [MIT](LICENSE) and the documentation is licensed [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/).

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 98.2% 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 ~42 days

Recently: every ~26 days

Total

26

Last Release

1717d ago

Major Versions

1.0.4 → 2.0.0-beta2019-11-14

2.2.3 → 3.0.0-beta2021-05-25

PHP version history (3 changes)1.0.0PHP &gt;=7.1.3

2.0.1PHP &gt;=7.2

3.0.0-betaPHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/643b22cfe15a5f3ff42dc06ce98f1e5024b6e4578fc9627a058097f5046164d8?d=identicon)[andrewdalpino](/maintainers/andrewdalpino)

---

Top Contributors

[![andrewdalpino](https://avatars.githubusercontent.com/u/18690561?v=4)](https://github.com/andrewdalpino "andrewdalpino (273 commits)")[![mlocati](https://avatars.githubusercontent.com/u/928116?v=4)](https://github.com/mlocati "mlocati (5 commits)")

---

Tags

linear-algebramatrixmatrix-factorizationmatrix-multiplicationphpscientific-computingtensorvectorphpvectormatrixmatharithmeticextensionsvdstatisticsphp-extensionlinear algebracomputingconvolutiontensoreigenvalueeigenvectormultithreadedcomputationtrigonometryengineeringdecompositionscientific computingsingular value decompositioneigendecompositionmatmulmatrix multiplicationsignal processing1d convolution2d convolutionblasdot productlapackvector normpseudoinverse

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/scienide-tensor/health.svg)

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

###  Alternatives

[rubix/tensor

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

2751.4M5](/packages/rubix-tensor)[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)[sciphp/numphp

PHP library for scientific computing.

6618.9k](/packages/sciphp-numphp)[rindow/rindow-math-matrix

The fundamental package for scientific matrix operation

13281.5k7](/packages/rindow-rindow-math-matrix)

PHPackages © 2026

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