jalallinux/php-pm2
Composer 安装命令:
composer require jalallinux/php-pm2
包简介
Manage pm2 process in php
关键字:
README 文档
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:
| Parameter | Type | Description |
|---|---|---|
sortField |
string | Sort field: name, id, pid, memory, cpu, status, uptime |
desc |
bool | Sort order is descending |
link ❓
Connect your server to your dashboard and start collecting metrics
pm2()->link(string $publicKey, string $secretKey, string|null $machineName = null): bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
publicKey |
string | PM2 account PUBLIC_KEY |
secretKey |
string | PM2 account SECRET_KEY |
machineName |
?string | Machine name on the dashboard |
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:
| Parameter | Type | Description |
|---|---|---|
command |
?string | Command to run in pm2 |
options |
array | Options to start pm2 command Guide like ['name' => 'process-1', 'no-autorestart'] |
findBy ❓
Find specific process
pm2()->findBy(string $key, string $value): \JalalLinuX\Pm2\Structure\Process|null
Parameters:
| Parameter | Type | Description |
|---|---|---|
key |
string | Key of property to find process |
value |
string | Value of key |
kill
kill daemon
pm2()->kill(): bool
pid
Fetch pid of specific process
pm2()->pid(string $name): int|null
Parameters:
| Parameter | Type | Description |
|---|---|---|
name |
string | Name of process |
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:
| Parameter | Type | Description |
|---|---|---|
idOrName |
string | Id or name of process |
restart ❓
Restart specific process
pm2()->restart(string $idOrName): bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
idOrName |
string | Id or name of process |
delete ❓
Delete specific process
pm2()->delete(string $idOrName): bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
idOrName |
string | Id or name of process |
save ❓
Freeze a process list for automatic respawn
pm2()->save(bool $force = true): bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
force |
bool | Force save list |
logOut ❓
Display all processes output logs
pm2()->logOut(string $idOrName = null, int $lines = 100): string
Parameters:
| Parameter | Type | Description |
|---|---|---|
idOrName |
?string | Id or name of process |
lines |
int | To dig in older logs |
logErr ❓
Display all processes error logs
pm2()->logErr(string $idOrName = null, int $lines = 100): string
Parameters:
| Parameter | Type | Description |
|---|---|---|
idOrName |
?string | Id or name of process |
lines |
int | To dig in older logs |
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:
| Parameter | Type | Description |
|---|---|---|
version |
string | Specific version |
isInstall
Check if the PM2 is installed
pm2()->isInstall(bool $forceInstall = false, string $version = 'latest'): bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
forceInstall |
bool | Install pm2 if is not installed |
version |
string | Specific version |
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.
jalallinux/php-pm2 适用场景与选型建议
jalallinux/php-pm2 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.2k 次下载、GitHub Stars 达 18, 最近一次更新时间为 2023 年 01 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「jalallinux」 「php-pm2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jalallinux/php-pm2 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jalallinux/php-pm2 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jalallinux/php-pm2 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A HTTP basic auth middleware for Laravel
Store key value pair in database as settings
ThingsBoard laravel client
Logging queries executed on Postgres even directly!!!
Connect laravel to Shinobi.video
This Package helps developers to easily connect to RPC servers.
统计信息
- 总下载量: 2.2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-15