PHPackages                             garoudan/phpmath - 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. garoudan/phpmath

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

garoudan/phpmath
================

Library to run Mathematica functions through PHP. Virtually could run any non-graphical Mathematica function.

022PHP

Since Jan 23Pushed 9y ago1 watchersCompare

[ Source](https://github.com/GarouDan/phpmath)[ Packagist](https://packagist.org/packages/garoudan/phpmath)[ RSS](/packages/garoudan-phpmath/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHPMath
=======

[](#phpmath)

PHPMath is a library to run [Mathematica](http://www.wolfram.com/mathematica/) functions through [PHP](http://php.net/).

Example:
--------

[](#example)

### Input:

[](#input)

`echo $phpmath->run("'Prime[1000]'");`

### Output:

[](#output)

`7919`

Requirements
============

[](#requirements)

This library uses php `shell_exec` function to do a call to Mathematica, so this function should be permitted.

This library usually aims \*nix systems but we think it could run on any other systems (not tested).

- If shell\_exec can run our `Shell.mathematica` script, should work.

Instructions
============

[](#instructions)

- Mathematica License¹:
    - Copy your Mathematica® license to the PHP home folder (for example, `/var/www`).
        - The license usually is on a hidden folder inside the licensed user home (for example, `/home/user/.Mathematica`).
        - In other words, for this example, the folder `.Mathematica` inside `/home/user` should be copied to `/var/www`.
        - Symlinks don't seem to be working.
- Composer:
    - Put `"garoudan/phpmath": "dev-master"` in your `composer.json` require section.
    - Example of a full `composer.json` file:

    ```

    {
            "require": {
                        "garoudan/phpmath": "dev-master"
            }
    }

```

- Make sure the `Shell.mathematica` have read and execution permission².

`sudo chmod 755 /path/to/the/vendor/of/your/project/garoudan/phpmath/core/Backend/Model/Mathematica/Shell.mathematica`

- Start coding:

    ```

    require_once 'path/to/your/composer/vendor/autoload.php';

    use PHPMath\PHPMath;

    $phpmath = new PHPMath;
    echo $phpmath->run("Prime[1000]");

```

Enjoy.

Troubleshooting
===============

[](#troubleshooting)

- **Was not possible make '.../Mathematica/Shell.mathematica' readable and executable**:
    - Make sure you did the step marked with **²** above.

`sudo chmod 755 /path/to/the/vendor/of/your/project/garoudan/phpmath/core/Backend/Model/Mathematica/Shell.mathematica`

- **Mathematica cannot find a valid password**:
    - Make sure you did the step marked with **¹** above.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.3% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/41f5e207f788ae39d555f8a995572e17e9c9e7459236160f17d437dd1da4fad9?d=identicon)[GarouDan](/maintainers/GarouDan)

---

Top Contributors

[![GarouDan](https://avatars.githubusercontent.com/u/1040561?v=4)](https://github.com/GarouDan "GarouDan (36 commits)")[![sepha-daniloSilva](https://avatars.githubusercontent.com/u/4688153?v=4)](https://github.com/sepha-daniloSilva "sepha-daniloSilva (1 commits)")

### Embed Badge

![Health badge](/badges/garoudan-phpmath/health.svg)

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

###  Alternatives

[phpdocumentor/graphviz

Wrapper for Graphviz

9611.3M21](/packages/phpdocumentor-graphviz)[beberlei/composer-monorepo-plugin

312503.1k](/packages/beberlei-composer-monorepo-plugin)[stephenjude/filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.

118126.9k](/packages/stephenjude-filament-feature-flags)[brotkrueml/schema

Embedding schema.org vocabulary - API and view helpers for schema.org markup

33584.6k13](/packages/brotkrueml-schema)[eduarguz/shift-php-cs

PHP CS Fixer - Laravel Coding Style Ruleset

1145.5k29](/packages/eduarguz-shift-php-cs)

PHPackages © 2026

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