super-kernel/scan-isolate
Composer 安装命令:
composer require super-kernel/scan-isolate
包简介
Scan isolators for PHP.
关键字:
README 文档
README
Process scan isolators for PHP 8.4.
Packagist package and source repository: super-kernel/scan-isolate.
This package provides a small ScanIsolatorInterface for scan work that may need to run in an isolated process while
keeping the public result model minimal.
Features
- explicit scan isolator contract
- lightweight
ScannedInterfaceresult NullScanIsolatorfor already-isolated PHAR runtimesPcntlScanIsolatorfor fork-based isolationProcScanIsolatorfor self-bootstrap isolation throughproc_open()- stdout and stderr forwarding in proc mode
- no custom worker entry script
Requirements
- PHP
~8.4.0 ext-jsonext-pcntlforPcntlScanIsolator- CLI and
proc_open()forProcScanIsolator
Installation
composer require super-kernel/scan-isolate
Quick Start
use SuperKernel\ScanIsolate\Executor\ProcScanIsolator; $isolator = new ProcScanIsolator(); if (!$isolator->supports()) { throw new RuntimeException('Proc scan isolation is not available.'); } $scanned = $isolator->execute(static function (): void { // scan logic runs in the isolated child process }); assert($scanned->isScanned()); // current process continues only after the isolated scan completed successfully
Contract
namespace SuperKernel\ScanIsolate\Contract; interface ScanIsolatorInterface { public function supports(): bool; public function execute(callable $callback): ScannedInterface; }
ScannedInterface::isScanned() tells you whether the scan workflow has completed successfully for the current call.
true: the scan was completed successfullyfalse: the scan has not been completed
Choosing an Isolator
| Isolator | Best fit | Child execution model | Parent return |
|---|---|---|---|
NullScanIsolator |
Already running inside a PHAR-isolated context | no extra process | Scanned(true) |
PcntlScanIsolator |
CLI runtime with ext-pcntl available |
pcntl_fork() |
Scanned(true) |
ProcScanIsolator |
CLI runtime where self-bootstrap via current entrypoint is acceptable | proc_open() + current $_SERVER['SCRIPT_FILENAME'] |
Scanned(true) |
Isolators
NullScanIsolator
Returns new Scanned(true) immediately.
Use it when the current runtime is already isolated, and you only want a consistent ScanIsolatorInterface.
PcntlScanIsolator
Uses pcntl_fork() and pcntl_waitpid().
- child process executes the callback and exits immediately
- parent process waits for child completion and returns
Scanned(true) - non-zero child exit raises
ScanIsolatorException
ProcScanIsolator
Starts a new PHP process with PHP_BINARY and the current $_SERVER['SCRIPT_FILENAME'].
The child process must reach the same execute() call naturally. There is no separate worker entry file.
- child process consumes the guard descriptor
- child process executes the callback
- child process writes a scan result token back to the parent
- child process exits immediately after the callback succeeds
- parent process forwards child stdout and stderr to the current output
- parent process returns
Scanned(true)after the child exits successfully
If the current entry script does not reach the scan point, or if the child exits non-zero, ScanIsolatorException is
thrown.
Usage
PcntlScanIsolator
use SuperKernel\ScanIsolate\Executor\PcntlScanIsolator; $isolator = new PcntlScanIsolator(); $scanned = $isolator->execute(static function (): void { // scan in the forked child process }); assert($scanned->isScanned()); // current process continues only after the child scan completed successfully
ProcScanIsolator
use SuperKernel\ScanIsolate\Executor\ProcScanIsolator; $isolator = new ProcScanIsolator(); $scanned = $isolator->execute(static function (): void { // scan in the self-bootstrapped child process }); assert($scanned->isScanned()); // current process continues only after the child scan completed successfully
Notes
supports()is a capability check, not a guarantee thatexecute()cannot fail at runtime.- child processes do not return to the caller after a successful callback; they terminate.
- callback failures are surfaced as
ScanIsolatorExceptionin the parent process. ProcScanIsolatoris designed for re-entering the current application entrypoint, not for launching a custom worker script.
Testing
php84 vendor/bin/phpunit
super-kernel/scan-isolate 适用场景与选型建议
super-kernel/scan-isolate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「scan」 「isolate」 「super-kernel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 super-kernel/scan-isolate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 super-kernel/scan-isolate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 super-kernel/scan-isolate 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Restrict your Craft CMS users on a per-entry basis
Unit of Work
AMWSCAN (Antimalware Scanner) is a php antimalware/antivirus scanner console script written in php for scan your project. This can work on php projects and a lot of others platform.
Isolate proxy classes generator
Isolate is an abstraction layer for data persistence. Operations related to tracking changes and saving data are done in transactions which makes your code not aware of sotrage type.
Framework is an implementation of Unit of Work and Lazy Objects components with Isolate abstraction layer.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-20