PHP code example of madeiteasytools / multiverse
1. Go to this page and download the library: Download madeiteasytools/multiverse library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
madeiteasytools / multiverse example snippets
use MadeItEasyTools\Multiverse\Facades\Multiverse;
$result = Multiverse::run('image_processor', [
'image_url' => 'https://example.com/image.jpg'
]);
// $result = ['status' => 'success', 'processed' => '...']
// Workers run indefinitely by default
$result = Multiverse::run('long_task', $data);
// config/multiverse.php
'timeout' => 300, // 5 minutes for all workers
// Override timeout for specific execution
$result = Multiverse::run('worker_name', [
'data' => 'value',
'_timeout' => 60 // 1 minute timeout
]);
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()
]);
}
// config/multiverse.php
'logging' => [
'enabled' => true,
'channel' => env('LOG_CHANNEL', 'stack'),
],
// config/multiverse.php
'security' => [
'scan_for_dangerous_code' => true,
'dangerous_patterns' => [
'rm -rf' => 'destructive deletion detected',
'mkfs' => 'formatting command detected',
'eval(' => 'code execution detected',
],
],
// 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',
'
// Run TensorFlow/PyTorch models
$prediction = Multiverse::run('ml_model', [
'image' => base64_encode($imageData)
]);
// OpenCV operations
$processed = Multiverse::run('image_processor', [
'path' => storage_path('images/photo.jpg'),
'operation' => 'resize',
'width' => 800
]);
// Pandas/NumPy analysis
$analysis = Multiverse::run('data_analyzer', [
'csv_path' => storage_path('data.csv'),
'operation' => 'statistics'
]);
// BeautifulSoup/Scrapy
$data = Multiverse::run('scraper', [
'url' => 'https://example.com',
'selector' => '.product-price'
]);
bash
php artisan multiverse:check --lang=python
bash
php artisan multiverse:install --lang=python
bash
php artisan vendor:publish --tag=multiverse-config
bash
php artisan multiverse:worker image_processor --lang=python
[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)..."
}
bash
$ php artisan multiverse:clear test_worker
Searching for processes matching worker: test_worker
Killed PID: 12345
✓ Killed 1 process(es)
bash
php artisan multiverse:update --lang=python
bash
php -r "echo ini_get('disable_functions');"
bash
# Remove proc_open from disable_functions in /etc/php/X.Y/fpm/php.ini
# Then restart PHP-FPM
systemctl restart php8.4-fpm