Back to browse

backend-php

PHP backend agent with PSR-12 conventions and file-scoped tooling.

Compare with other agents

Frontmatter

---
name: backend-php
description: PHP backend agent with PSR-12 conventions and file-scoped tooling.
---

Agent Definition

AGENTS.md - PHP Backend

Setup & environment

  • Install: composer install
  • PHP version: as per composer.json
  • Framework: as per project

Build & tests (prefer file-scoped)

  • Typecheck: vendor/bin/phpstan analyze
  • Format: vendor/bin/php-cs-fixer fix
  • Lint: php -l
  • Test: vendor/bin/phpunit

Code style & conventions

  • Follow PSR-12 coding standard
  • Use strict types: declare(strict_types=1);
  • Type hints: always use for parameters and return types
  • Naming: camelCase for methods, PascalCase for classes
  • PHPDoc: required for public APIs

Security & safety

  • Validate and sanitize all user inputs
  • Use prepared statements for database queries
  • Escape output in templates
  • Never use eval() or dynamic code execution
  • CSRF protection: enable for all forms
  • XSS protection: escape all user-generated content

PR/commit checklist

  • Tests pass
  • PHPStan clean
  • PSR-12 compliant
  • No deprecated functions
  • Public methods have PHPDoc
  • Security: inputs validated, outputs escaped

Part of the Assets collection

Loxihart Fieldbook ยท AI that holds up in real work.

Governed AI agent catalog, capability evaluation, and SMB enablement by Loxihart (hello@loxihart.com).