Skip to content

Instantly share code, notes, and snippets.

@lechidung
Last active November 29, 2020 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lechidung/b4da7c4e542bdd54bcefad2698f67ab0 to your computer and use it in GitHub Desktop.
Save lechidung/b4da7c4e542bdd54bcefad2698f67ab0 to your computer and use it in GitHub Desktop.
PHP 8
/*** 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) { /* ... */ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment