PHPackages                             lisachenko/native-php-matrix - 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. lisachenko/native-php-matrix

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

lisachenko/native-php-matrix
============================

PHP extension that provides Matrix class powered with overloaded operators

0.2.0(5y ago)4452MITPHPPHP ^7.4|^8.0CI passing

Since Dec 11Pushed 5y ago3 watchersCompare

[ Source](https://github.com/lisachenko/native-php-matrix)[ Packagist](https://packagist.org/packages/lisachenko/native-php-matrix)[ GitHub Sponsors](https://github.com/lisachenko)[ RSS](/packages/lisachenko-native-php-matrix/feed)WikiDiscussions master Synced today

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

Native matrix library
---------------------

[](#native-matrix-library)

For a long time, PHP developers dreamed of being able to overload operators. And now, finally, this moment has come. Thanks to the PHP7.4 and the [lisachenko/z-engine](https://github.com/lisachenko/z-engine) package, we can overload the operators of comparison, addition, multiplication, casting and much more!

This library is first ever userland PHP extension, that implements operator overloading for the `Matrix` class.

[![GitHub release](https://camo.githubusercontent.com/936aa40f0bd2419ddadd7efa2f451469e983e7bf56f39f0e48bb9d5a66e15591/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6c6973616368656e6b6f2f6e61746976652d7068702d6d61747269782e737667)](https://github.com/lisachenko/native-php-matrix/releases/latest)[![Minimum PHP Version](https://camo.githubusercontent.com/92fabb75236db7d7453db0680cfab230e4ba78cc321ad3864794f78327f3f3b0/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e342d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/a88e07ffc94c4bbeee5efe0d23c12cd1a9dda5969c38137d6a0ac71b6fa53cd7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c6973616368656e6b6f2f6e61746976652d7068702d6d61747269782e737667)](https://packagist.org/packages/lisachenko/native-php-matrix)[![GitHub Workflow Status](https://camo.githubusercontent.com/e19eb9469a6882ab57756095d286f41d162cf96e5e51acae5619678785b1bf48/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6c6973616368656e6b6f2f6e61746976652d7068702d6d61747269782f504850556e69742532307465737473)](https://github.com/lisachenko/native-php-matrix/actions/workflows/phpunit.yml)

Pre-requisites and initialization
---------------------------------

[](#pre-requisites-and-initialization)

As this library depends on `FFI`, it requires PHP&gt;=7.4 and `FFI` extension to be enabled. Also, current limitations of [lisachenko/z-engine](https://github.com/lisachenko/z-engine) are also applied (x64, NTS)

To install this library, simply add it via `composer`:

```
composer require lisachenko/native-php-matrix
```

Now you can test it with following example:

```
