Category: Laravel, Laravel, api, api

James Bannister • July 10, 2021 • 4 minute read In this post I want to show how we use Guzzle middleware with Guzzle and Laravel Http clients to catch 422 validation failures from external services and turn them into local validation failures. This approach can be used for catching other errors, and you'd just need to adjust it to cover your use case.

The validation rules are usually in sync, but occasionally there are rules that you cannot support in a different service.

So, from time to time, we have requests that will pass validation in the portal, but fail against the service due to one of these rules.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners