# WP-CLI — cheat sheet PHP compatibility WordPress

**Référence juillet 2026** · PHP Compatibility Checker by Volade (V+) · Plugin Check officiel

---

## Prérequis

```bash
# Vérifier WP-CLI
wp --info

# Depuis la racine WordPress (staging recommandé)
cd /chemin/vers/wordpress
```

---

## PHP Compatibility Checker by Volade (V+)

```bash
# Statut rapide — dernier scan mémorisé
wp pcc status

# Scan complet preset PHP 8.3
wp pcc scan --preset=php83

# Scan preset migration hébergeur
wp pcc scan --preset=host-migration

# Export JSON pour ticket client / CI artefact
wp pcc export --format=json --file=pcc-report-$(date +%Y%m%d).json

# Export CSV (historique agence)
wp pcc export --format=csv --file=pcc-report.csv

# Cibler version précise
wp pcc scan --php=8.4
```

---

## Plugin Check (officiel WordPress)

```bash
# Vérifier un plugin .org
wp plugin check mon-plugin --format=table

# Tous les plugins actifs .org
wp plugin list --status=active --field=name | xargs -I {} wp plugin check {}
```

---

## Pipeline agence (exemple bash)

```bash
#!/bin/bash
set -e
SITE_PATH="/var/www/staging-client"
PHP_TARGET="8.3"

cd "$SITE_PATH"

wp core update-db --quiet
wp pcc scan --preset=php83
wp pcc export --format=json --file="/tmp/pcc-${PHP_TARGET}-$(basename $SITE_PATH).json"

ERRORS=$(wp pcc status --field=errors 2>/dev/null || echo "manual-check")
if [ "$ERRORS" != "0" ]; then
  echo "BLOCKED: $ERRORS blocking errors — do not switch PHP"
  exit 1
fi

echo "OK: ready for PHP $PHP_TARGET switch"
```

---

## PHP_CodeSniffer (dev — hors wp-admin)

```bash
# Depuis le dossier plugin/thème
composer require --dev phpcompatibility/php-compatibility
vendor/bin/phpcs -p plugin-folder/ --standard=PHPCompatibility --runtime-set testVersion 8.3
```

---

## Santé du site (core WordPress)

```bash
wp site health
wp option get siteurl
php -v   # version CLI — peut différer de PHP-FPM web !
```

---

## Pièges fréquents

| Piège | Solution |
|-------|----------|
| `php -v` ≠ PHP web | Vérifier dans **Outils → Santé du site** ou `phpinfo()` staging |
| Scan prod sans backup | **Staging miroir** obligatoire |
| Oublier mu-plugins | Inclure `wp-content/mu-plugins/` dans scope PCC |
| CI sans V+ | PHPCS + PHPCompatibilityWP en alternative |

---

*Téléchargement public · [PHP Compatibility Checker by Volade](https://volade.com/fr/cms/wordpress/extensions/php-compatibility-checker-by-volade)*
