Http Action Naming (ARCH7004)
Key php.naming.route-handler-naming · Severity info · Category naming
Controller action names should reflect the semantics of the HTTP verb they map to (GET → get/list, POST → create). RESTful consistency lets readers infer a route’s effect from its name.
Incorrect
Section titled “Incorrect”<?php
class UserController{ #[Route('/users', methods: ['POST'])] public function getUser(Request $request): Response { return $this->repo->store($request->all()); }}Correct
Section titled “Correct”<?php
class UserController{ #[Route('/users', methods: ['POST'])] public function createUser(Request $request): Response { return $this->repo->store($request->all()); }}Align the action name with its HTTP verb: create for POST, get/list for GET.