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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners