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(2w ago)6101MITPHPPHP ^8.2

Since Feb 8Pushed 4mo agoCompare

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

READMEChangelog (1)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)[![License](https://camo.githubusercontent.com/850eae1099d2b05f53383473d7cd51f9bc1ab09b7d0d9e5122f1dd930efdcc6d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e737667)](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

---

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

[](#-installation)

```
composer require madeiteasytools/multiverse
```

### 1. Setup Python Environment

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

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

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

### 2. Publish Configuration (Optional)

[](#2-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: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'),
    ],

    // Python configuration
    'python' => [
        'root_path' => base_path('multiverse/python'),
        'venv_path' => base_path('multiverse/python/venv'),
        'requirements_file' => base_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)

### 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/madeiteasytools/multiverse/issues)
- **Email**:

---

**Made with ❤️ by MadeItEasyTools**

###  Health Score

41

↑

FairBetter than 87% of packages

Maintenance84

Actively maintained with recent releases

Popularity13

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

15d 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 (12 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.2k95.4M306](/packages/laravel-horizon)[illuminate/queue

The Illuminate Queue package.

21332.6M1.6k](/packages/illuminate-queue)[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[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.

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

The Illuminate Process package.

44869.2k98](/packages/illuminate-process)

PHPackages © 2026

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