PHPackages                             madeiteasytools/multiverse - 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. [API Development](/categories/api)
4. /
5. madeiteasytools/multiverse

ActiveLibrary[API Development](/categories/api)

madeiteasytools/multiverse
==========================

Multi-Language Worker Integration for Laravel - Run Python, Node.js and more from your Laravel app

v2.1.1(2mo ago)6101MITPHPPHP ^8.2

Since Feb 8Pushed 2mo agoCompare

[ Source](https://github.com/udaykiranchenna2/Multiverse)[ Packagist](https://packagist.org/packages/madeiteasytools/multiverse)[ RSS](/packages/madeiteasytools-multiverse/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (8)Versions (6)Used By (0)

MadeItEasyTools/Multiverse 🌌
============================

[](#madeiteasytoolsmultiverse-)

**Run Python, Node.js, and other languages natively inside your Laravel application.**

Bridge the gap between PHP's web dominance and Python's data supremacy. Run "Workers" written in other languages as if they were native Laravel classes.

[![Latest Version](https://camo.githubusercontent.com/a5219ecfdfb576f3950d7a631ad15e218be600bd339c7bf027a899a3895b91ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d616465697465617379746f6f6c732f6d756c746976657273652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/madeiteasytools/multiverse)[![Laravel](https://camo.githubusercontent.com/da2f0a63ea2d566933deef7cbad8355404a82cbbc0e76f625f365df438af15cf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3131253230253743253230313225323025374325323031332d7265643f7374796c653d666c61742d737175617265)](https://laravel.com)[![License](https://camo.githubusercontent.com/d6997ade4ff3fd1457947934d304e622eaef86080bac866d609d0fbdd3fbdd7e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f756461796b6972616e6368656e6e61322f4d756c746976657273653f7374796c653d666c61742d737175617265)](LICENSE.md)

---

✨ Features
----------

[](#-features)

- **🚀 Performance Optimized**: Sub-500ms execution times via pre-installed environments
- **🛡️ Robust Error Handling**: Custom exceptions with detailed context
- **⏱️ Configurable Timeouts**: Prevent hanging workers with flexible timeout options
- **📊 Automatic Logging**: Failed workers logged with full context
- **🧹 Process Management**: Manual cleanup command for zombie processes
- **🐍 Python Native**: First-class support for Python 3.x
- **📦 Shared Dependencies**: One `requirements.txt` for all workers
- **🛠️ Artisan Integration**: `multiverse:worker`, `multiverse:install`, `multiverse:update`, `multiverse:clear`
- **🔒 Security**: Built-in static analysis to block dangerous commands

---

🖥️ Server Requirements
----------------------

[](#️-server-requirements)

Before installing, ensure your server meets these requirements:

### PHP

[](#php)

- PHP 8.1+
- `proc_open` must **not** be in `disable_functions` in `php.ini`

> **Shared hosting / HestiaCP / cPanel**: These panels often disable `proc_open` in PHP-FPM pools. You must remove it from `disable_functions` in your pool config or global `php.ini` for the package to work. See [Troubleshooting](#-troubleshooting).

### Python Workers

[](#python-workers)

If you plan to use Python workers, the server also needs:

PackagePurposeInstall (Ubuntu/Debian)`python3` (3.8+)Python runtimepre-installed on most servers`python3-venv`Virtual environment support`apt install python3.X-venv``python3-dev`Python headers (for C extensions)`apt install python3.X-dev``build-essential`C/C++ compiler (`gcc`, `g++`)`apt install build-essential`> Replace `X` with your Python version (e.g. `python3.12-venv` for Python 3.12). `python3-dev` and `build-essential` are only needed if your `requirements.txt` includes packages that compile from source (e.g. `pyswisseph`, `numpy`, `Pillow`).

**Quick check:**

```
python3 --version          # should be 3.8+
python3 -m venv --help     # should not error
gcc --version              # needed for C extensions
```

---

📦 Installation
--------------

[](#-installation)

```
composer require madeiteasytools/multiverse
```

### 1. Check Server Requirements

[](#1-check-server-requirements)

Before setting up, verify your server has everything needed:

```
php artisan multiverse:check --lang=python
```

Example output:

```
  Multiverse Requirements Check

  PHP
  ✓ PHP 8.4.0
  ✓ proc_open is available

  Python
  ✓ Python 3.12.3
  ✓ Version 3.12 meets 3.8+ requirement
  ✓ python3-venv available
  ✓ gcc 13.2.0
  ✓ g++ 13.2.0
  ✓ pip available in venv

  ✓ All requirements met. You are good to go!

```

Each failing check prints the exact `apt install` command to fix it. Returns exit code `1` if any requirement is missing — useful in CI/CD pipelines.

### 2. Setup Python Environment

[](#2-setup-python-environment)

```
php artisan multiverse:install --lang=python
```

This creates a `multiverse/` directory, sets up a virtual environment, and automatically updates your `.gitignore`.

### 3. Publish Configuration (Optional)

[](#3-publish-configuration-optional)

```
php artisan vendor:publish --tag=multiverse-config
```

---

🚀 Quick Start
-------------

[](#-quick-start)

### Create a Worker

[](#create-a-worker)

```
php artisan multiverse:worker image_processor --lang=python
```

### Write Your Python Logic

[](#write-your-python-logic)

Edit `multiverse/python/image_processor/main.py`:

```
import sys
import json

def main():
    # 1. Read Input
    data = json.loads(sys.stdin.read())

    # 2. Process Data
    result = {
        "status": "success",
        "processed": data['image_url']
    }

    # 3. Return Output
    print(json.dumps(result))

if __name__ == "__main__":
    main()
```

### Run from Laravel

[](#run-from-laravel)

```
use MadeItEasyTools\Multiverse\Facades\Multiverse;

$result = Multiverse::run('image_processor', [
    'image_url' => 'https://example.com/image.jpg'
]);

// $result = ['status' => 'success', 'processed' => '...']
```

---

⚙️ Advanced Features
--------------------

[](#️-advanced-features)

### Timeout Configuration

[](#timeout-configuration)

**Default (Unlimited):**

```
// Workers run indefinitely by default
$result = Multiverse::run('long_task', $data);
```

**Global Timeout:**

```
// config/multiverse.php
'timeout' => 300, // 5 minutes for all workers
```

**Per-Worker Timeout:**

```
// Override timeout for specific execution
$result = Multiverse::run('worker_name', [
    'data' => 'value',
    '_timeout' => 60  // 1 minute timeout
]);
```

### Error Handling

[](#error-handling)

```
use MadeItEasyTools\Multiverse\Exceptions\WorkerException;
use MadeItEasyTools\Multiverse\Exceptions\TimeoutException;

try {
    $result = Multiverse::run('risky_worker', $data);
} catch (TimeoutException $e) {
    // Worker exceeded timeout
    Log::error('Worker timed out', [
        'worker' => $e->getWorkerName(),
        'timeout' => $e->getMessage()
    ]);
} catch (WorkerException $e) {
    // Worker failed (exit code != 0)
    Log::error('Worker failed', [
        'worker' => $e->getWorkerName(),
        'exit_code' => $e->getExitCode(),
        'error' => $e->getErrorOutput()
    ]);
}
```

### Automatic Error Logging

[](#automatic-error-logging)

Failed workers are automatically logged to `storage/logs/laravel.log`:

```
// config/multiverse.php
'logging' => [
    'enabled' => true,
    'channel' => env('LOG_CHANNEL', 'stack'),
],
```

**Log Entry Example:**

```
[2026-02-08 12:00:00] local.ERROR: Multiverse Worker Failed: image_processor
{
    "worker": "image_processor",
    "driver": "python",
    "input": {"image_url": "..."},
    "error": "ValueError: Invalid image format",
    "exception": "MadeItEasyTools\\Multiverse\\Exceptions\\WorkerException",
    "stderr": "Traceback (most recent call last)..."
}

```

### Process Cleanup

[](#process-cleanup)

Kill hanging or zombie worker processes:

```
# Clear all multiverse processes
php artisan multiverse:clear

# Clear specific worker
php artisan multiverse:clear worker_name
```

**Example:**

```
$ php artisan multiverse:clear test_worker
Searching for processes matching worker: test_worker
  Killed PID: 12345
✓ Killed 1 process(es)
```

---

📚 Managing Dependencies
-----------------------

[](#-managing-dependencies)

### Add Python Packages

[](#add-python-packages)

1. Edit `multiverse/python/requirements.txt`:

```
numpy==1.24.0
opencv-python-headless==4.8.0
requests==2.31.0
```

2. Update environment:

```
php artisan multiverse:update --lang=python
```

### Shared Virtual Environment

[](#shared-virtual-environment)

All Python workers share one virtual environment, saving disk space and installation time.

---

🔒 Security
----------

[](#-security)

### Static Code Analysis

[](#static-code-analysis)

Block dangerous patterns in worker code:

```
// config/multiverse.php
'security' => [
    'scan_for_dangerous_code' => true,
    'dangerous_patterns' => [
        'rm -rf' => 'destructive deletion detected',
        'mkfs' => 'formatting command detected',
        'eval(' => 'code execution detected',
    ],
],
```

### Best Practices

[](#best-practices)

✅ **Validate Input**: Always validate data before passing to workers
✅ **Use Timeouts**: Set reasonable timeouts for all workers
✅ **Monitor Logs**: Check `storage/logs` for worker failures
✅ **Limit Permissions**: Run workers with minimal system permissions
✅ **Sanitize Output**: Validate worker output before using in your app

---

🛠️ Artisan Commands
-------------------

[](#️-artisan-commands)

CommandDescription`multiverse:check --lang=python`Check server requirements`multiverse:install --lang=python`Setup language environment`multiverse:update --lang=python`Update dependencies`multiverse:worker name --lang=python`Create new worker`multiverse:run worker`Run worker manually`multiverse:clear [worker]`Kill zombie processes---

📖 Configuration Reference
-------------------------

[](#-configuration-reference)

```
// config/multiverse.php
return [
    // Worker storage path
    'workers_path' => base_path('multiverse'),

    // Default timeout (null = unlimited)
    'timeout' => null,

    // Automatic error logging
    'logging' => [
        'enabled' => true,
        'channel' => env('LOG_CHANNEL', 'stack'),
    ],

    // pip install/upgrade timeout in seconds
    'pip_timeout' => 300,

    // Python configuration
    'python' => [
        'root_path' => 'multiverse/python',
        'venv_path' => 'multiverse/python/venv',
        'requirements_path' => 'multiverse/python/requirements.txt',
    ],

    // Security settings
    'security' => [
        'scan_for_dangerous_code' => true,
        'dangerous_patterns' => [
            // Add your patterns here
        ],
    ],
];
```

---

🎯 Use Cases
-----------

[](#-use-cases)

### AI &amp; Machine Learning

[](#ai--machine-learning)

```
// Run TensorFlow/PyTorch models
$prediction = Multiverse::run('ml_model', [
    'image' => base64_encode($imageData)
]);
```

### Image Processing

[](#image-processing)

```
// OpenCV operations
$processed = Multiverse::run('image_processor', [
    'path' => storage_path('images/photo.jpg'),
    'operation' => 'resize',
    'width' => 800
]);
```

### Data Science

[](#data-science)

```
// Pandas/NumPy analysis
$analysis = Multiverse::run('data_analyzer', [
    'csv_path' => storage_path('data.csv'),
    'operation' => 'statistics'
]);
```

### Web Scraping

[](#web-scraping)

```
// BeautifulSoup/Scrapy
$data = Multiverse::run('scraper', [
    'url' => 'https://example.com',
    'selector' => '.product-price'
]);
```

---

🐛 Troubleshooting
-----------------

[](#-troubleshooting)

### proc\_open Disabled

[](#proc_open-disabled)

```
LogicException: The Process class relies on proc_open, which is not available on your PHP installation.

```

`proc_open` is disabled in your PHP configuration. This is common on shared hosting and control panels (HestiaCP, cPanel, Plesk).

**Fix — check what's disabled:**

```
php -r "echo ini_get('disable_functions');"
```

**Fix — global php.ini** (affects all sites):

```
# Remove proc_open from disable_functions in /etc/php/X.Y/fpm/php.ini
# Then restart PHP-FPM
systemctl restart php8.4-fpm
```

**Fix — per-site PHP-FPM pool** (safer, affects only your site):

Edit your pool config (e.g. `/etc/php/8.4/fpm/pool.d/yoursite.conf`) and add:

```
php_admin_value[disable_functions] = pcntl_fork,pcntl_exec,...,exec,system,passthru,shell_exec,popen
```

Omit `proc_open` from the list. Note: pool config can only add to the global list, not remove from it — so `proc_open` must also be absent from the global `php.ini`.

### python3-venv Not Installed

[](#python3-venv-not-installed)

```
RuntimeException: The virtual environment was not created successfully because ensurepip is not available.

```

```
apt install python3.12-venv -y   # replace 12 with your Python version
rm -rf multiverse/python/venv
php artisan multiverse:install --lang=python
```

### C Extension Build Fails (Python.h / g++ not found)

[](#c-extension-build-fails-pythonh--g-not-found)

```
fatal error: Python.h: No such file or directory
error: command 'x86_64-linux-gnu-g++' failed: No such file or directory

```

```
apt install python3.12-dev build-essential -y
rm -rf multiverse/python/venv
php artisan multiverse:install --lang=python
```

### Worker Not Found

[](#worker-not-found)

```
RuntimeException: Worker not found: my_worker

```

**Solution**: Check that `multiverse/python/my_worker/main.py` exists.

### Timeout Issues

[](#timeout-issues)

```
TimeoutException: Worker [my_worker] timed out after 60 seconds

```

**Solution**: Increase timeout or optimize worker code.

### Import Errors

[](#import-errors)

```
ModuleNotFoundError: No module named 'numpy'

```

**Solution**: Add package to `requirements.txt` and run `multiverse:update`.

### Zombie Processes

[](#zombie-processes)

```
Worker seems stuck and won't respond

```

**Solution**: Run `php artisan multiverse:clear worker_name`.

---

📄 License
---------

[](#-license)

MIT License - see [LICENSE.md](LICENSE.md) for details.

---

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

---

📞 Support
---------

[](#-support)

- **Issues**: [GitHub Issues](https://github.com/udaykiranchenna2/Multiverse/issues)
- **Email**:

---

**Made with ❤️ by MadeItEasyTools**

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance88

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~43 days

Total

4

Last Release

60d ago

Major Versions

v1.0.0 → v2.0.02026-06-18

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/80169523?v=4)[Udaykiran Chenna](/maintainers/udaykiranchenna2)[@udaykiranchenna2](https://github.com/udaykiranchenna2)

---

Top Contributors

[![udaykiranchenna2](https://avatars.githubusercontent.com/u/80169523?v=4)](https://github.com/udaykiranchenna2 "udaykiranchenna2 (18 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/madeiteasytools-multiverse/health.svg)

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k99.8M354](/packages/laravel-horizon)[illuminate/queue

The Illuminate Queue package.

20433.0M1.8k](/packages/illuminate-queue)[illuminate/console

The Illuminate Console package.

13046.6M7.3k](/packages/illuminate-console)[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M188](/packages/spatie-laravel-health)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)[illuminate/process

The Illuminate Process package.

44926.6k129](/packages/illuminate-process)

PHPackages © 2026

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