|
| 1 | +# AGENT.md — Code Review Knowledge Base for phpList/core |
| 2 | + |
| 3 | +## 🧭 Repository Overview |
| 4 | + |
| 5 | +This repository is the **core package** of **phpList 4**, a modular and extensible email campaign management system. |
| 6 | + |
| 7 | +- **Purpose:** Provides the reusable foundation and framework for phpList applications and modules. |
| 8 | +- **Consumers:** `phpList/web-frontend`, `phpList/rest-api`, and `phpList/base-distribution`. |
| 9 | +- **Core responsibilities:** |
| 10 | + - Application bootstrapping and service configuration |
| 11 | + - Database ORM (Doctrine) integration |
| 12 | + - Command-line utilities (Symfony Console) |
| 13 | + - Async email sending via Symfony Messenger |
| 14 | + - Logging, configuration, routing, dependency injection |
| 15 | + - Schema definition and updates |
| 16 | + |
| 17 | +> **Note:** This repository does *not* contain UI or REST endpoints. Those are part of other phpList packages. |
| 18 | +
|
| 19 | +--- |
| 20 | + |
| 21 | +## ⚙️ Tech Stack |
| 22 | + |
| 23 | +| Category | Technology | |
| 24 | +|-----------|-------------| |
| 25 | +| Language | PHP ≥ 8.1 | |
| 26 | +| Framework | Symfony 6.x components | |
| 27 | +| ORM | Doctrine ORM 3.x | |
| 28 | +| Async / Queue | Symfony Messenger | |
| 29 | +| Tests | PHPUnit | |
| 30 | +| Static analysis | PHPStan | |
| 31 | +| Docs | PHPDocumentor | |
| 32 | +| License | AGPL-3.0 | |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## 📁 Project Structure |
| 37 | +- .github/ CI/CD and PR templates |
| 38 | +- bin/ Symfony console entrypoints |
| 39 | +- config/ Application & environment configs |
| 40 | +- docs/ Developer documentation and generated API docs |
| 41 | +- public/ Public entrypoint for local web server |
| 42 | +- resources/Database/ Canonical SQL schema |
| 43 | +- src/ Core PHP source code |
| 44 | +- tests/ PHPUnit test suites |
| 45 | +- composer.json Package metadata and dependencies |
| 46 | +- phpunit.xml.dist Test configuration |
| 47 | +- phpstan.neon Static analysis configuration |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## 💡 Code Design Principles |
| 52 | + |
| 53 | +1. **Modularity:** |
| 54 | + The core remains framework-like — decoupled from frontend or API layers. |
| 55 | + |
| 56 | +2. **Dependency Injection:** |
| 57 | + Use Symfony’s service container; avoid static/global dependencies. |
| 58 | + |
| 59 | +3. **Strict Typing:** |
| 60 | + Always use `declare(strict_types=1);` and explicit type declarations. |
| 61 | + |
| 62 | +4. **Doctrine Entities:** |
| 63 | + - Keep entities simple (no business logic). |
| 64 | + - Mirror schema changes in `resources/Database/Schema.sql`. |
| 65 | + - Maintain backward compatibility with phpList 3. |
| 66 | + |
| 67 | +5. **Symfony Best Practices:** |
| 68 | + Follow Symfony structure and naming conventions. Use annotations or attributes for routing. |
| 69 | + |
| 70 | +6. **Error Handling & Logging:** |
| 71 | + - Prefer structured logging via Graylog. |
| 72 | + - Catch and handle exceptions at service or command boundaries. |
| 73 | + |
| 74 | +7. **Async Email:** |
| 75 | + - Uses Symfony Messenger. |
| 76 | + - Handlers must be idempotent and retry-safe. |
| 77 | + - Avoid blocking or synchronous email sending. |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## 🧪 Testing Guidelines |
| 82 | + |
| 83 | +- **Framework:** PHPUnit |
| 84 | +- **Database:** SQLite or mocks for unit tests; MySQL for integration tests. |
| 85 | +- **Coverage target:** ≥85% for core logic. |
| 86 | +- **Naming:** Mirror source structure (e.g., `Mailer.php` → `MailerTest.php`). |
| 87 | + |
| 88 | + |
| 89 | +## 🧱 Code Style |
| 90 | + |
| 91 | +- Follow PSR-12 and Symfony coding conventions. |
| 92 | +- Match the current codebase’s formatting and spacing. |
| 93 | +- Use meaningful, consistent naming. |
| 94 | +- Apply a single responsibility per class. |
| 95 | + |
| 96 | + |
| 97 | +## 🔄 Pull Request Review Guidelines |
| 98 | +### 🔐 Security Review Notes |
| 99 | + |
| 100 | +- Do not log sensitive data (passwords, tokens, SMTP credentials). |
| 101 | +- Sanitize all user and external inputs. |
| 102 | +- Always use parameterized Doctrine queries. |
| 103 | +- Async jobs must be retry-safe and idempotent. |
0 commit comments