PHPackages                             super-kernel/scan-isolate - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. super-kernel/scan-isolate

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

super-kernel/scan-isolate
=========================

Scan isolators for PHP.

03PHP

Since Apr 20Pushed 1mo agoCompare

[ Source](https://github.com/super-kernel/scan-isolate)[ Packagist](https://packagist.org/packages/super-kernel/scan-isolate)[ RSS](/packages/super-kernel-scan-isolate/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

super-kernel/scan-isolate
=========================

[](#super-kernelscan-isolate)

[![PHP ~8.4.0](https://camo.githubusercontent.com/0e7595da97be968884472435938c073879569544041a94856b639b6f730fc933/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d7e382e342e302d3737374242342e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](#requirements)[![License: MIT](https://camo.githubusercontent.com/1e64768fef09f35b66921728160f533208fd2e3e792a2755187d16c25d535511/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d3232633535652e737667)](LICENSE)[![GitHub Repository](https://camo.githubusercontent.com/f6e614909b53f62604211c3af72587fffe3f7f76de36c7681bc858cdbc022302/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d73757065722d2d6b65726e656c2532467363616e2d2d69736f6c6174652d3138313731372e7376673f6c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](https://github.com/super-kernel/scan-isolate)[![GitHub Stars](https://camo.githubusercontent.com/98a128025a56b7c24a432f7835a60304577561e2ac64c1b1c2e418445772dd08/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f73757065722d6b65726e656c2f7363616e2d69736f6c6174653f6c6f676f3d67697468756226636f6c6f723d663562333031)](https://github.com/super-kernel/scan-isolate/stargazers)

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
--------

[](#features)

- explicit scan isolator contract
- lightweight `ScannedInterface` result
- `NullScanIsolator` for already-isolated PHAR runtimes
- `PcntlScanIsolator` for fork-based isolation
- `ProcScanIsolator` for self-bootstrap isolation through `proc_open()`
- stdout and stderr forwarding in proc mode
- no custom worker entry script

Requirements
------------

[](#requirements)

- PHP `~8.4.0`
- `ext-json`
- `ext-pcntl` for `PcntlScanIsolator`
- CLI and `proc_open()` for `ProcScanIsolator`

Installation
------------

[](#installation)

```
composer require super-kernel/scan-isolate
```

Quick Start
-----------

[](#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
--------

[](#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 successfully
- `false`: the scan has not been completed

Choosing an Isolator
--------------------

[](#choosing-an-isolator)

IsolatorBest fitChild execution modelParent return`NullScanIsolator`Already running inside a PHAR-isolated contextno 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
---------

[](#isolators)

### NullScanIsolator

[](#nullscanisolator)

Returns `new Scanned(true)` immediately.

Use it when the current runtime is already isolated, and you only want a consistent `ScanIsolatorInterface`.

### PcntlScanIsolator

[](#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

[](#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
-----

[](#usage)

### PcntlScanIsolator

[](#pcntlscanisolator-1)

```
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

[](#procscanisolator-1)

```
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
-----

[](#notes)

- `supports()` is a capability check, not a guarantee that `execute()` cannot fail at runtime.
- child processes do not return to the caller after a successful callback; they terminate.
- callback failures are surfaced as `ScanIsolatorException` in the parent process.
- `ProcScanIsolator` is designed for re-entering the current application entrypoint, not for launching a custom worker script.

Testing
-------

[](#testing)

```
php84 vendor/bin/phpunit
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance59

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/78034820?v=4)[wheakerd](/maintainers/wheakerd)[@wheakerd](https://github.com/wheakerd)

---

Top Contributors

[![wheakerd](https://avatars.githubusercontent.com/u/78034820?v=4)](https://github.com/wheakerd "wheakerd (2 commits)")

### Embed Badge

![Health badge](/badges/super-kernel-scan-isolate/health.svg)

```
[![Health](https://phpackages.com/badges/super-kernel-scan-isolate/health.svg)](https://phpackages.com/packages/super-kernel-scan-isolate)
```

###  Alternatives

[mediawiki/babel

Users can easily indicate their language proficiency on their user page

116.4k](/packages/mediawiki-babel)[infoweb-internet-solutions/yii2-cms-analytics

Analytics module for Yii2

112.4k1](/packages/infoweb-internet-solutions-yii2-cms-analytics)

PHPackages © 2026

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