2.0 KiB
2.0 KiB
AGENT CODING STANDARDS
This project is a PHP MVC application using Composer, Twig, and FastRoute, running in an LXC container.
🛠️ Development Commands
| Type | Command | Notes |
|---|---|---|
| Dependencies | incus exec www composer install / incus exec www composer update |
Run from the host machine. Apache2 with PHP/Composer runs in the INCUS container 'www'. The folder ./ is shared with /var/www/localhost/ in the container, and port 80 is shared with the host. Use update after editing composer.json. |
| Linting | N/A | No dedicated tool. Adhere to PSR-12 standards. |
| Testing | curl localhost |
No testing framework configured. Avoid adding tests until one is introduced. |
📐 Code Style & Conventions
- Architecture: Strict MVC pattern. Logic in
src/Controllers, data access insrc/Models, views intemplates/. - Namespacing: Use
App\as the base namespace (PSR-4). - Naming: Classes are
PascalCase. Functions, methods, and variables arecamelCase. - Templating: Use Twig (
.twig). All HTML rendering must be done via Twig. - I18n: All user-facing strings must use
App\Services\TranslationService(PHP) or{{ trans('ID') }}(Twig). - Error Handling: Use PHP's native exception handling (
try/catch). Log critical errors witherror_log(). - Database: Access SQLite via
App\Database\Database::getInstance(). Do not use directnew PDO(). - Imports: Use fully qualified class names or
usestatements at the top of the file. - Security: Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.
- Types: Use type hints for function parameters and return types where possible.
- Formatting: Follow PSR-12 standards for code formatting.
- Comments: Do not add comments unless explicitly requested.
- Libraries: Only use libraries already in composer.json. Check composer.json before adding new dependencies.