Chapters
28 Chapters
|
1:45:06
|
This course is archived!
This tutorial uses a deprecated micro-framework called Silex. The fundamentals of REST are still valid, but the code we use can't be used in a real application.
Login to bookmark this video
-
Course Code
Subscribe to download the code!
Subscribe to download the code!
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
14.
PUT: Editing Resources
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
This tutorial uses a deprecated micro-framework called Silex. The fundamentals of REST are still valid, but the code we use can't be used in a real application.
What PHP libraries does this tutorial use?
// composer.json
{
"require": {
"silex/silex": "~1.0", // v1.3.2
"symfony/twig-bridge": "~2.1", // v2.7.3
"symfony/security": "~2.4", // v2.7.3
"doctrine/dbal": "^2.5.4", // v2.5.4
"monolog/monolog": "~1.7.0", // 1.7.0
"symfony/validator": "~2.4", // v2.7.3
"symfony/expression-language": "~2.4" // v2.7.3
},
"require-dev": {
"behat/mink": "~1.5", // v1.5.0
"behat/mink-goutte-driver": "~1.0.9", // v1.0.9
"behat/mink-selenium2-driver": "~1.1.1", // v1.1.1
"behat/behat": "~2.5", // v2.5.5
"behat/mink-extension": "~1.2.0", // v1.2.0
"phpunit/phpunit": "~5.7.0", // 5.7.27
"guzzle/guzzle": "~3.7" // v3.9.3
}
}
7 Comments
According to RFC 7231 when PUT fails, must send a 204 (No Content) response to indicate not successful completion of the
request, but in the video I see that we throwing 404. is it ok? Thanks for reply ;)
Hey Michal,
You probably understand it wrong, because all 2xx statuses mean successful operations, that's why when something went wrong - you either return 4xx or 5xx response, depends on the problem. 204 status means that your request was successfully handled but no content was returned to user back, i.e. it means that some operation on the server side was executed successfully.
I hope it helps.
Cheers!
Does `createAction` will be better to use instead of `newAction` in this case, doesn't it? To be consistent with `updateAction`.
What do you think, Ryan?
Yea, createAction is probably a little better, because we ultimately return a 201 "Created" status code. newAction is just a habit I have! :)
I could rename all entries of `newAction` to `createAction` in this repo with PR. Or it will be too excessive and better live it as is?
I think it's better as it is (to match the video). Allowing the code/script to update, while making it clear when the video doesn't match the updated code is something that's tough. For now, unless it's a bug, I usually leave it alone.
But anyways - you rock for even asking :)
Yes, you right! I forgot about usage this name in video :)
"Houston: no signs of life"
Start the conversation!