Join Justin Yost for an in-depth discussion in this video Exceptions and Guzzle, part of Consuming RESTful APIs in PHP with Guzzle.
- Exceptions are one of the ways…we generally speaking controlling an application's flow.…Exceptions provide the ability to…determine the state and handle edge-cases in an application.…Let's explore some exceptions in Guzzle now.…We'll first open and copy the file…first.php, and we'll create a new…file, and name it exceptions.php.…And we'll paste in and save the…contents from first.php in here now.…Okay.…Now that we have our exceptions file,…we need to create some exceptions.…
First off, we have an exception…class for a 400-style HTTP error.…These HTTP status codes detail when…an error occurred that the user can't actually fix.…These are most commonly caused because…you have requested a resource that doesn't exist.…I.e. the classic 404 error.…Let's generate one, then catch it,…so we can then see how best to handle them.…Before line 6, we need to wrap our…request method in a try/catch block.…The catch will be after we echo our body.…
So we'll add on line 6, try, and then…we'll close our try after line 13…and we'll add a catch, and now in here…
- 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?
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.