PHP code example of goncalves-rodrigues / security-linter

1. Go to this page and download the library: Download goncalves-rodrigues/security-linter 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/ */

    

goncalves-rodrigues / security-linter example snippets






use SecurityLinter\Linter;

// Scanne un répertoire ou un fichier
$issues = Linter::scanAndReport('/chemin/vers/votre/projet');

if (!empty($issues)) {
    echo "Problèmes détectés :\n";
    print_r($issues);
} else {
    echo "Aucun problème détecté.\n";
}



use SecurityLinter\Linter;

// Corrige automatiquement un fichier spécifique
Linter::autoFixXSS('/chemin/vers/votre/fichier.php');


$nom = $_POST['prenom'];
echo $nom;


$nom = cleanXSSCustom($_POST['prenom']);
echo $nom;

public static function scanAndReport(string $path): array

public static function autoFixXSS(string $filePath): void