Files
screamingFrog/README.md
Martin e569d189d5 Add comprehensive quality tooling and fix code style issues
Quality Tools Added:
- PHPStan (Level 8) for static analysis
- PHP_CodeSniffer (PSR-12) for code style
- Updated PHPUnit test suite with type safety

Code Improvements:
- Fixed all PHPStan Level 8 errors (13 issues)
- Auto-fixed 25 PSR-12 code style violations
- Added proper type hints for arrays and method parameters
- Fixed PDOStatement|false handling in api.php and tests
- Improved null-safety for parse_url() calls

Configuration:
- phpstan.neon: Level 8, analyzes src/ and tests/
- phpcs.xml: PSR-12 standard, excludes vendor/
- docker-compose.yml: Mount config files for tooling
- composer.json: Add phpstan, phpcs, phpcbf scripts

Documentation:
- Updated README.md with testing and quality sections
- Updated AGENTS.md with quality gates and workflows
- Added pre-commit checklist for developers

All tests pass (9/9), PHPStan clean (0 errors), PHPCS compliant (1 warning)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 23:58:21 +02:00

113 lines
2.5 KiB
Markdown

# PHP Docker Anwendung
Eine PHP-Anwendung mit MariaDB, die in Docker läuft.
## Anforderungen
- Docker
- Docker Compose
## Installation & Start
1. Container starten:
```bash
docker-compose up -d
```
2. Container stoppen:
```bash
docker-compose down
```
3. Container neu bauen:
```bash
docker-compose up -d --build
```
## Services
- **PHP Anwendung**: http://localhost:8080
- **phpMyAdmin**: http://localhost:8081
- **MariaDB**: Port 3306
## Datenbank Zugangsdaten
- **Host**: mariadb
- **Datenbank**: app_database
- **Benutzer**: app_user
- **Passwort**: app_password
- **Root Passwort**: root_password
## Struktur
```
.
├── docker-compose.yml # Docker Compose Konfiguration
├── Dockerfile # PHP Container Image
├── start.sh # Container Start-Script
├── init.sql # Datenbank Initialisierung
├── config/
│ └── nginx/
│ └── default.conf # Nginx Konfiguration
└── src/
└── index.php # Hauptanwendung
```
## Entwicklung
Die Anwendungsdateien befinden sich im `src/` Verzeichnis und werden als Volume in den Container gemountet, sodass Änderungen sofort sichtbar sind.
## Tests & Code-Qualität
### Unit Tests ausführen
Die Anwendung verwendet PHPUnit für Unit- und Integrationstests:
```bash
# Alle Tests ausführen
docker-compose exec php sh -c "php /var/www/html/vendor/bin/phpunit /var/www/tests/"
# Alternative mit Composer-Script
docker-compose exec php composer test
```
Die Tests befinden sich in:
- `tests/Unit/` - Unit Tests
- `tests/Integration/` - Integration Tests
### Statische Code-Analyse mit PHPStan
PHPStan ist auf Level 8 (höchstes Level) konfiguriert und analysiert den gesamten Code:
```bash
# PHPStan ausführen
docker-compose exec php sh -c "php -d memory_limit=512M /var/www/html/vendor/bin/phpstan analyse -c /var/www/phpstan.neon"
# Alternative mit Composer-Script
docker-compose exec php composer phpstan
```
**PHPStan Konfiguration:**
- Level: 8 (strictest)
- Analysierte Pfade: `src/` und `tests/`
- Ausgeschlossen: `vendor/` Ordner
- Konfigurationsdatei: `phpstan.neon`
### Code Style Prüfung mit PHP_CodeSniffer
PHP_CodeSniffer (PHPCS) prüft den Code gegen PSR-12 Standards:
```bash
# Code Style prüfen
docker-compose exec php composer phpcs
# Code Style automatisch korrigieren
docker-compose exec php composer phpcbf
```
**PHPCS Konfiguration:**
- Standard: PSR-12
- Analysierte Pfade: `src/` und `tests/`
- Ausgeschlossen: `vendor/` Ordner
- Auto-Fix verfügbar mit `phpcbf`