Retour aux cas pratiques
SymfonyFondamental

Création d'un contrôleur Symfony avec route fonctionnelle

Scénario

Contexte : Vous démarrez un nouveau projet Symfony et devez exposer un endpoint simple pour valider l'installation. Le Problème : Aucun contrôleur personnalisé n'est encore configuré. Contraintes : Utiliser les annotations ou attributs PHP pour définir la route. Ne pas placer la logique directement dans le fichier routes.yaml. Livrable attendu : Créer un contrôleur avec une route GET /health retournant une réponse JSON { "status": "ok" } avec code HTTP 200.

Compétences ciblées

symfonycontrollerroutingbackend
    Création d'un contrôleur Symfony avec route fonctionnelle — mise en situation Symfony | CodeDuel