API versioning (ARCH7202)
Ce contenu n’est pas encore disponible dans votre langue.
Key php.quality.api-versioning · Severity info · Category quality
API endpoints without an explicit version make backward-incompatible changes breaking for clients. Add the version to the path or an attribute.
Incorrect
Section titled “Incorrect”<?php#[Route('/users', methods: ['GET'])]public function index(): JsonResponse{ return $this->json($this->repo->all());}Correct
Section titled “Correct”<?php#[Route('/v1/users', methods: ['GET'])]public function index(): JsonResponse{ return $this->json($this->repo->all());}Add an explicit API version to the route path or a versioning attribute.