Join Justin Yost for an in-depth discussion in this video PSR-7 middleware, part of Consuming RESTful APIs in PHP with Guzzle.
- [Instructor] PSR-7 supports a feature called middleware.…Middleware is, at its most basic level,…the ability to place code outside of your application…before a request leaves the server, or the reverse,…before your application processes a response.…The code to get started with middleware…is a bit complicated,…so I've provided some sample code for you to work off of.…If you open up the exercise files for this lesson...…You'll see there's a snippets.txt in the file.…
We'll want to open up this file…and copy the entire contents.…Go over to your editor.…We'll create a new file.…We'll save this file as psr7middleware.php.…And we'll past in the contents…from our snippets.txt file in here now.…Let's explore exactly what this file does.…Starting at the top.…On lines one through seven,…we have our standard require use lines.…
These different use lines that we're importing…are the different parts of the middleware…that we'll be building up.…Notice we have a RequestInterface and a ResponseInterface,…and then we have a HandlerStack, a Middleware,…
- 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?
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.