Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lucianonascimento's avatar

Real example of PUT and PATCH (API)

There is some API repo open source bases on Laravel that I can see PUT and PATCH applied in real life ?

0 likes
4 replies
martinbean's avatar
Level 80

@lucianonascimento Laravel uses both interchangeably but in terms of the HTTP specification, you would use PUT if you were passing all of a resources attributes to be updated (i.e. “This is the resource you should put at this URI) and PATCH would be used to only update some attributes of a resource (i.e. update these attributes with these values on the resource at this URI).

So you can see these verbs are quite closely aligned with their “real world” definitions. You can either say to the server: “Put what I’m giving you at this URI” or “patch what’s at this URI with what I’ve giving you”.

1 like

Please or to participate in this conversation.