1. Go to this page and download the library: Download hfryan/php-cop 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/ */
hfryan / php-cop example snippets
bash
# Install globally
composer global ATH
php ~/.composer/vendor/hfryan/php-cop/bin/phpcop.php setup
bash
# Install in your PHP project
composer in/phpcop.php scan
bash
# Basic CI check - fail on any vulnerabilities
phpcop scan --fail-on=low --quiet
echo "Exit code: $?"
# Production deployment - fail only on high/critical vulnerabilities
phpcop scan --fail-on=high --format=json > security-report.json
echo "Exit code: $?"
# Security-focused scan - exclude dev dependencies
phpcop scan --exclude-dev --min-severity=moderate --exit-code=enhanced
echo "Exit code: $?"
# Legacy compatibility mode (simple 0/1 exit codes)
phpcop scan --exit-code=legacy --fail-on=high
echo "Exit code: $?"