PHP code example of andreapollastri / checkpoint

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

    

andreapollastri / checkpoint example snippets


'checks' => [
    Checks\ComposerAuditCheck::class      => true,
    Checks\NpmAuditCheck::class           => false, // skip npm audit on a PHP-only project
    Checks\EnvironmentCheck::class        => true,
    // …
    Checks\PackageFreshnessCheck::class   => true,
    Checks\SupplyChainToolingCheck::class => true,
],

'package_freshness' => [
    'minimum_age_days' => 3,
    'whitelist' => [
        'andreapollastri/checkpoint', // bundled — see note below
        // 'laravel/framework',
        // 'symfony/console',
    ],
],

'suppressed' => [
    'a1b2c3d4e5f6',
    '9f8e7d6c5b4a',
],

use Checkpoint\Checks\AbstractCheck;
use Checkpoint\Checks\CheckResult;

class MyCustomCheck extends AbstractCheck
{
    public function name(): string
    {
        return 'My Custom Check';
    }

    public function run(): CheckResult
    {
        // your logic here
        return CheckResult::pass('Everything looks good.');
        // or: CheckResult::warn('Something to review.', ['detail one', 'detail two']);
        // or: CheckResult::fail('Critical issue found.', ['detail']);
    }
}

use Checkpoint\Scanner;

$scanner = Scanner::withDefaultChecks(base_path())
    ->add(new MyCustomCheck());

php artisan checkpoint:scan
bash
php artisan checkpoint:scan
bash
php artisan checkpoint:scan --only="SQL Injection Risks,CSRF Protection"
bash
php artisan checkpoint:scan --skip="NPM CVE Audit,Debug Functions in Production Code"
bash
php artisan checkpoint:scan --json
bash
php artisan vendor:publish --tag=checkpoint-config

FAIL  Hardcoded Secrets
      3 potential hardcoded secret(s) found.
        ✗ app/Services/PaymentService.php:14 — 'api_key' => 'sk_live_…' [a1b2c3d4e5f6]
        ✗ config/services.php:8 — $secret = 'super…'                    [9f8e7d6c5b4a]
bash
php artisan checkpoint:github
bash
php artisan checkpoint:gitlab
bash
php artisan checkpoint:install-hooks