Table of Contents

Symfony Architecture & Code Review Checklist

1. Architecture Review

System Design

Checklist:

Recommended Structure:

src/
├── Domain/
│   ├── Entity/
│   ├── ValueObject/
│   ├── Repository/
│   ├── Service/
│   └── Event/
│
├── Application/
│   ├── Command/
│   ├── Query/
│   ├── Handler/
│   ├── DTO/
│   └── UseCase/
│
├── Infrastructure/
│   ├── Persistence/
│   ├── Messaging/
│   ├── ExternalApi/
│   └── Security/
│
├── Presentation/
│   ├── Controller/
│   ├── Request/
│   └── Response/

2. Controller Review

Controller Responsibilities

Checklist:

Bad:

public function create()
{
    // validation
    // business logic
    // database
    // email sending
}

Good:

public function create(
    CreateOrderCommand $command
)
{
    $this->commandBus->dispatch($command);
}

3. Service Layer Review

Business Services

Checklist:

Example:

OrderService
PaymentService
InventoryService
UserRegistrationService

Application Services

Checklist:


4. Dependency Injection Review

Checklist:

Good:

class OrderService
{
    public function __construct(
        private OrderRepository $repository
    ) {}
}

Bad:

$container->get('service');

5. Domain Layer Review

Entities

Checklist:

Bad:

public string $status;

Good:

private string $status;
 
public function markPaid(): void
{
    ...
}

Value Objects

Checklist:

Example:

Money
Email
Address
PhoneNumber

6. Doctrine Review

Entity Mapping

Checklist:

Query Performance

Checklist:

Bad:

foreach ($orders as $order) {
    echo $order->getCustomer()->getName();
}

Good:

SELECT o,c
FROM Order o
JOIN FETCH o.customer c

7. Database Review

Migrations

Checklist:

Commands:

php bin/console make:migration
php bin/console doctrine:migrations:migrate

Index Review

Checklist:


8. API Review

REST API

Checklist:

Response Structure

Checklist:

Example:

{
  "success": true,
  "data": {}
}

9. Security Review

Authentication

Checklist:

Authorization

Checklist:

Good:

$this->denyAccessUnlessGranted(
    'ORDER_EDIT',
    $order
);

Input Security

Checklist:


10. Validation Review

Symfony Validator

Checklist:

Example:

#[Assert\NotBlank]
#[Assert\Email]
private string $email;

11. Messenger Review

Queue Design

Checklist:

Good Candidates:

Example:

$messageBus->dispatch(
    new ProcessOrderMessage()
);

12. Event Driven Design

Domain Events

Checklist:

Examples:

OrderCreated
OrderPaid
UserRegistered
InvoiceGenerated

13. Caching Review

Checklist:

Example:

$cache->get(
    'products',
    fn() => $repository->findAll()
);

14. Logging Review

Monolog

Checklist:

Good:

$logger->info(
    'Order created',
    ['orderId' => $orderId]
);

15. Performance Review

Application Performance

Checklist:

Doctrine Performance

Checklist:

Example:

$em->flush();
$em->clear();

16. Testing Review

Unit Tests

Checklist:

Integration Tests

Checklist:

Functional Tests

Checklist:

Coverage Targets:


17. CI/CD Review

Quality Gates

Checklist:

Pipeline:

Git Push
 ↓
PHP-CS-Fixer
 ↓
PHPStan
 ↓
Unit Tests
 ↓
Integration Tests
 ↓
Build
 ↓
Deploy

18. Observability Review

Monitoring

Checklist:

Tracing

Checklist:


19. Production Readiness

Deployment

Checklist:

Scalability

Checklist:

Disaster Recovery

Checklist:


20. Symfony-Specific Best Practices

Checklist:

Production Commands:

php bin/console cache:clear --env=prod
php bin/console cache:warmup --env=prod
composer install --no-dev --optimize-autoloader

21. Senior Symfony Review Questions

  1. [ ] Is business logic independent from Symfony?
  2. [ ] Can domain logic be reused outside HTTP?
  3. [ ] Are controllers thin?
  4. [ ] Is Doctrine used efficiently?
  5. [ ] Are queues used for heavy work?
  6. [ ] Is every endpoint validated?
  7. [ ] Is authorization enforced?
  8. [ ] Can failures be retried safely?
  9. [ ] Can the application scale horizontally?
  10. [ ] Will this wake me up at 3 AM?

If all answers are YES, the Symfony application is Production Ready.


Symfony Architecture Maturity Score

Category Target
Architecture 9/10
Domain Design 9/10
Security 9/10
Performance 9/10
Testing 8/10+
Scalability 9/10
Observability 8/10+
Maintainability 9/10

Overall Production Grade Target: >= 85%

For Symfony, one additional review area that many senior teams emphasize is DDD + CQRS + Messenger:

Domain
├── Entities
├── Value Objects
├── Domain Events
└── Repository Interfaces

Application
├── Commands
├── Command Handlers
├── Queries
├── Query Handlers
└── DTOs

Infrastructure
├── Doctrine
├── Messenger
├── Redis
├── External APIs
└── Security

Presentation
├── Controllers
├── API
└── Console Commands