https://github.com/lisachenko/native-php-matrix
PHP Library that provides an implementation of userland types, powered with overloaded operators
https://github.com/lisachenko/native-php-matrix
ffi operator-overloading php74 z-engine
Last synced: 10 months ago
JSON representation
PHP Library that provides an implementation of userland types, powered with overloaded operators
- Host: GitHub
- URL: https://github.com/lisachenko/native-php-matrix
- Owner: lisachenko
- License: mit
- Created: 2019-12-11T15:26:29.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-06-27T09:16:14.000Z (over 4 years ago)
- Last Synced: 2025-03-23T22:13:30.803Z (10 months ago)
- Topics: ffi, operator-overloading, php74, z-engine
- Language: PHP
- Size: 20.5 KB
- Stars: 44
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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.
[](https://github.com/lisachenko/native-php-matrix/releases/latest)
[](https://php.net/)
[](https://packagist.org/packages/lisachenko/native-php-matrix)
[](https://github.com/lisachenko/native-php-matrix/actions/workflows/phpunit.yml)
Pre-requisites and initialization
--------------
As this library depends on `FFI`, it requires PHP>=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`:
```bash
composer require lisachenko/native-php-matrix
```
Now you can test it with following example:
```php