Join Justin Yost for an in-depth discussion in this video PSR-7 headers, part of Consuming RESTful APIs in PHP with Guzzle.
- [Instructor] Now let's discuss PSR-7 style headers.…We've seen some of this earlier, but we'll explore headers…a bit more in this video.…We'll again, begin like we have generally,…by opening up first.php and copying the contents out of it.…We'll create a new file…labeled PSR7headers.php.…We'll paste in the contents from our first.php file…in here now.…
In the past, we saw how to access all the headers…with the method get headers.…This time, we'll access a single header.…First, we can check if a header is present…using the method has header.…We'll erase the lines 11 and 12,…and instead, put on line 11…if response…and call the method has header,…and then we'll pass in the string for content type.…
Inside of our if statement on line 12,…we'll add to echo, response, and then call the…method get header, and again with the string content type.…Notice here, again, after the end of this,…we'll add in our new line…with backslash R, backslash N.…Now one of the interesting parts of this with PSR-7…is that the get header method returns an array.…
- 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 35m 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?
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.