Skip to main content

Overview

Core controllers return response contracts that implement Responsable. You can replace any core response by binding its contract to your own class.

Replace a core response

Create a custom response that implements the same contract:

Bind the response contract

Bind the contract to your custom class in a service provider:

Use responses in controllers

Return response contracts and resolve them from the container when you need constructor arguments:

Available response contracts

See the Responses Reference for a complete list of available response contracts.