PHP code example of infocyph / phpprobe

1. Go to this page and download the library: Download infocyph/phpprobe 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/ */

    

infocyph / phpprobe example snippets


use Infocyph\PHPProbe\CommentChecker;
use Infocyph\PHPProbe\DuplicateChecker;
use Infocyph\PHPProbe\Graph\CodeGraphExtractor;
use Infocyph\PHPProbe\ReferenceChecker;
use Infocyph\PHPProbe\SyntaxChecker;

$syntaxExit = (new SyntaxChecker())->run(['--format=json', 'src']);
$referenceExit = (new ReferenceChecker())->run(['--format=json', 'src']);
$duplicateExit = (new DuplicateChecker())->run(['--mode=gate', 'src']);
$commentExit = (new CommentChecker())->run(['--fail-on=warning', 'src']);
$graph = (new CodeGraphExtractor())->extract(['/project/src/Service.php'], '/project');
bash
php vendor/bin/phpprobe syntax src tests
php vendor/bin/phpprobe reference src tests
php vendor/bin/phpprobe duplicates src
php vendor/bin/phpprobe comments src tests
php vendor/bin/phpprobe graph --pretty --output=build/code-graph.json src tests
php vendor/bin/phpprobe check src tests
bash
php vendor/bin/phpprobe reference src tests
php vendor/bin/phpprobe reference --format=phpstan-json src
bash
php vendor/bin/phpprobe graph --pretty --output=build/code-graph.json src tests
bash
# Fast deterministic gate
php vendor/bin/phpprobe duplicates --mode=gate --min-lines=5 --min-tokens=90 src

# Deeper structural audit
php vendor/bin/phpprobe duplicates \
  --mode=audit \
  --near-miss \
  --min-statements=4 \
  --min-similarity=0.88 \
  --max-clone-groups=100000 \
  src
bash
php vendor/bin/phpprobe duplicates --write-baseline=.phpprobe-duplicates-baseline.json src
php vendor/bin/phpprobe duplicates --baseline=.phpprobe-duplicates-baseline.json src
bash
php vendor/bin/phpprobe comments --write-baseline=.phpprobe-comments-baseline.json src
php vendor/bin/phpprobe comments --baseline=.phpprobe-comments-baseline.json src
bash
php vendor/bin/phpprobe syntax --parallel=2 --timeout=30 src tests
bash
php vendor/bin/phpprobe check --changed-only --changed-base=origin/main