jalallinux / php-pm2
Manage pm2 process in php
Fund package maintenance!
jalallinux
Requires
- php: ^7.4|^8.0|^8.1|^8.2
- ext-json: *
Requires (Dev)
- pestphp/pest: ^1.20
- spatie/ray: ^1.28
This package is auto-updated.
Last update: 2024-12-08 11:41:45 UTC
README
Use and Manage PM2 in php
Installation
You can install the package via composer:
composer require jalallinux/php-pm2
Usage
Pm2
- Full name: \JalalLinuX\Pm2\Pm2
list ❓
Fetch list all running applications
pm2()->list(string $sortField = 'name', bool $desc = true): array<Process>
Parameters:
link ❓
Connect your server to your dashboard and start collecting metrics
pm2()->link(string $publicKey, string $secretKey, string|null $machineName = null): bool
Parameters:
unlink ❓
Disconnect your server from your metrics dashboard
pm2()->unlink(): bool
start ❓
Start command with specifics options or start a ecosystem.config.js
pm2()->start(string $command = null, array $options = []): bool
Parameters:
findBy ❓
Find specific process
pm2()->findBy(string $key, string $value): \JalalLinuX\Pm2\Structure\Process|null
Parameters:
kill
kill daemon
pm2()->kill(): bool
pid
Fetch pid of specific process
pm2()->pid(string $name): int|null
Parameters:
flush ❓
Empty all log files
pm2()->flush(): bool
update ❓
Update in memory pm2
pm2()->update(): mixed
stopAll ❓
Stop all processes
pm2()->stopAll(): bool
restartAll ❓
Restart all processes
pm2()->restartAll(): bool
deleteAll ❓
Will stop and delete all processes from pm2 list
pm2()->deleteAll(): bool
stop ❓
Stop specific process
pm2()->stop(string $idOrName): bool
Parameters:
restart ❓
Restart specific process
pm2()->restart(string $idOrName): bool
Parameters:
delete ❓
Delete specific process
pm2()->delete(string $idOrName): bool
Parameters:
save ❓
Freeze a process list for automatic respawn
pm2()->save(bool $force = true): bool
Parameters:
logOut ❓
Display all processes output logs
pm2()->logOut(string $idOrName = null, int $lines = 100): string
Parameters:
logErr ❓
Display all processes error logs
pm2()->logErr(string $idOrName = null, int $lines = 100): string
Parameters:
startup ❓
Generate an active startup script
pm2()->startup(): bool
version ❓
Fetch installed pm2 version
pm2()->version(): string
install ❓
Install PM2 (Requirements: node
, npm
)
pm2()->install(string $version = 'latest'): false|string|null
Parameters:
isInstall
Check if the PM2 is installed
pm2()->isInstall(bool $forceInstall = false, string $version = 'latest'): bool
Parameters:
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.