Collections/AGENTS.md

1.3 KiB

AGENT CODING STANDARDS

This project is a PHP MVC application using Composer, Twig, FastRoute, and SQLite in an LXC container.

🛠️ Development Commands

  • Dependencies: composer install / update (updates after editing composer.json)
  • Linting: N/A (adhere to PSR-12 manually)
  • Testing: curl localhost (no framework; run manual scripts like php test.php for single tests)
  • Build: N/A (direct PHP execution)
  • Version Control: git status / add / commit / push

📐 Code Style & Conventions

  1. Architecture: MVC pattern (Controllers in src/Controllers/, Models in src/Models/, Views in templates/)
  2. Namespacing: PSR-4 with App\ base
  3. Naming: Classes PascalCase, methods/variables camelCase
  4. Templating: Twig only (.twig files)
  5. I18n: Use App\Services\TranslationService (PHP) or {{ trans('ID') }} (Twig)
  6. Error Handling: try/catch blocks; log with error_log()
  7. Database: Use App\Database\Database::getInstance() (no direct PDO)
  8. Imports: use statements at top or fully qualified names
  9. Security: No secrets/keys exposure or logging
  10. Types: Type hints on params/returns where possible
  11. Formatting: PSR-12
  12. Comments: Avoid unless requested
  13. Libraries: Check composer.json before adding