Chapters
26 Chapters
|
2:18:26
|
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!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
16.
I <3 HATEOAS Installation
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
"jms/serializer": "~0.16", // 0.16.0
"willdurand/hateoas": "~2.3" // v2.3.0
},
"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
}
}
10 Comments
Hi !
I have trouble installing HATEOAS here.
First, the provided link doesn't work anymore, I get an blank page.
Secondly, when trying to install it via Composer, I have the following issue :
`Your requirements could not be resolved to an installable set of packages.
Problem 1
Do you know how I could solve the issue ? It seems that I have a version conflict.
Hey abyssweb!
Ah, I see it! This tutorial is starting to show its age (the concepts are still great, but the code is getting old). When this tutorial was recorded, running this composer require command installed version 2.3 of the library. Now it installed version 3.1, which is incompatible (as you saw) with some other stuff we have installed (particularly our version of the expression language). To follow the tutorial exactly, try this instead:
We'll add a note about it :).
Cheers!
I'm not used to Disqus, and I edited too much my precedent reply.
Well I was able to install HATEOAS v2.3, I had to downgrade JMSSerializer to do so. I copied the composer.json from the finish course code.
Now, even when using only the finish course code, the battle.feature doesn't work anymore, I have a big PHP error block (using XDebug isn't a great idea when working on API I think).
I will follow the rest of the course only on video. The principles are still good so, it will still be useful ! Thank you !
Hi ! Thank you for your answer.
Now it seems like I have an issue with my version for JMSSerializer :
` Problem 1
, 1.13.0, 1.14.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.0-RC1, 1.6.0, 1.6.0-RC1, 1.6.1, 1.6.2, 1.7.0, 1.7.0-RC1, 1.7.0-RC2,
1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.9.2, 1.x-dev] but these conflict with your requirements or minimum-stability.
, 1.13.0, 1.14.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.0-RC1, 1.6.0, 1.6.0-RC1, 1.6.1, 1.6.2, 1.7.0, 1.7.0-RC1, 1.7.0-RC2,
1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.9.2, 1.x-dev] but these conflict with your requirements or minimum-stability.
, 1.13.0, 1.14.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.0-RC1, 1.6.0, 1.6.0-RC1, 1.6.1, 1.6.2, 1.7.0, 1.7.0-RC1, 1.7.0-RC2,
1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.9.2, 1.x-dev] but these conflict with your requirements or minimum-stability.
, 1.13.0, 1.14.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.0-RC1, 1.6.0, 1.6.0-RC1, 1.6.1, 1.6.2, 1.7.0, 1.7.0-RC1, 1.7.0-RC2,
1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.9.2, 1.x-dev] but these conflict with your requirements or minimum-stability.
onflict with your requirements or minimum-stability.
se conflict with your requirements or minimum-stability.
se conflict with your requirements or minimum-stability.
se conflict with your requirements or minimum-stability.
1.13.0, 1.14.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.0-RC1, 1.6.0, 1.6.0-RC1, 1.6.1, 1.6.2, 1.7.0, 1.7.0-RC1, 1.7.0-RC2,
1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.9.2, 1.x-dev] but these conflict with your requirements or minimum-stability.
.0, 1.7.0, 1.7.0-RC1, 1.7.0-RC2, 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.9.2, 1.x-dev] but these conflict with your requirements or minimum-s
tability.
.0, 1.7.0, 1.7.0-RC1, 1.7.0-RC2, 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.9.2, 1.x-dev] but these conflict with your requirements or minimum-s
tability.
, 1.13.0, 1.14.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.0-RC1, 1.6.0, 1.6.0-RC1, 1.6.1, 1.6.2, 1.7.0, 1.7.0-RC1, 1.7.0-RC2,
1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.9.2, 1.x-dev] but these conflict with your requirements or minimum-stability.
v2.5.0, v2.6.0, v2.7.0, v2.8.0, v2.8.1, v2.9.0]. `
I will try to downgrade my JMS version so it can satisfy the HATEOAS version.
Edit : I downgraded in my composer.json the JMSSerializer from ^3.1 to ~1.0 and I could install HATEOAS v2.3. Thank you !
Edit 2: Even by copying the composer.json from the finish course code, now my tests don't pass anymore, I have a PHP error concerning JMSSerializer.
Hey Virginie,
If you used to use a more fresh version of JMSSerializer like 3.1 before and then downgraded to the 1.0 - it makes sense, your tests might be broken due to it because of BC breaks. It sounds like you have to fix using of JMSSerializer in some places - use it in v1.0 way.
I hope it helps!
Cheers!
I managed to find a suitable configuration to finish the course. I downgraded everything, even my PHP version, and I could follow the video while practicing.
Thank you for your answer !
Hey Virginie,
I'm glad you were able to continue the course. It's good to download the course code and code along with us, this way you will have the exact code we have in our screencasts. But if you want to apply this code in your own project - it might be tricky sometimes.
Cheers!
hi,
i was wondering, what's your take on hal+json vs json-ld?
Yo Flavius Andrei!
Great question :). I sort of... don't have one. It seems this battle is being fought still, and ultimately, the usefulness of these standard formats is somewhat limited (it'll be really useful when more clients know how to automatically read the different formats). Plus, sometimes creating the responses in the different formats can be laborious, and often I find myself a bit frustrated by the formats (they look "busy" to me).
That being said, it does seem like Hal isn't getting as much love as some other formats right now. And ultimately, I just want to pick the winner :). So if JSON-LD feels good to you, and you have some libraries to help you output it, go for it. It's definitely a solid format. Just remember who your API clients are (either you, or if you have real API clients that will use your API) - make sure it works for them!
Cheers!
well, i was going with json-ld until i saw this video :) now i switched to hal. i've never paid any attention to it up until the detailed explanation i found here. now, i love it :)
thanks and keep up the awesome work!
"Houston: no signs of life"
Start the conversation!