Join Justin Yost for an in-depth discussion in this video PSR-7 requests, part of Consuming RESTful APIs in PHP with Guzzle.
- [Narrator] So now that we understand a bit…about what PSR-7 is, let's explore some of the specifics…of both how Guzzle implements PSR-7,…as well as exactly what happens…when we create and form a PSR-7 style request.…First up, we'll create a new file…and we'll label this file psr7request.php.…Here we'll start first with loading in the auto loader.…So on line one we'll have our php open tags,…and then line two we'll have our require,…and then in quotes, 'vendor/autoload.php.'…And so now we can load in the request object…that we'll work with.…
Line three should read as use GuzzleHttp\Psr7\request.…Now let's create a request instance.…On line five, we'll add a variable request…will be equal to new request.…And this request object can take two parameters.…The first is the http verb that we'll be using,…in this case GET.…
In the second will be the URL that we'll be requesting.…For this we'll use…http://jsonplaceholder.typicode.com/posts/1.…So we have a request now.…Recall, in PSR-7, requests and responses…are considered immutable.…
- Installing Guzzle
- Sending basic requests
- Sending asynchronous requests
- Sending concurrent requests
- Sending query data
- Sending request data
- Advanced Guzzle request options
- Reviewing basic Guzzle responses
- Processing response headers
- Reviewing PSR-7 requests, responses, bodies, and headers
Skill Level Intermediate
PHP: Clean URLs on Apache Serverwith David Powers1h 36m Intermediate
PHP: Managing Persistent Sessionswith David Powers2h 41m Intermediate
1. Guzzle Basics
2. Requests with Guzzle
3. Responses with Guzzle
4. Guzzle and PSR-7
5. Testing and Guzzle
Next steps1m 12s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.