Instead of PHPDoc annotations, you can now use structured metadata with PHP’s native syntax.
// PHP 7 class PostsController { /** * @Route("/api/posts/{id}", methods={"GET"}) */ public function get($id) { /* ... */ } } // PHP 8 class PostsController { #[Route("/api/posts/{id}", methods: ["GET"])] public function get($id) { /* ... */ } }
That’s it!. Please share your thoughts or suggestions in the comments below.