Controller
Controller is the HTTP inbound adapter that validates delivery input and calls one UseCase.
Generated facts
- Layer
- service
- Generated path
app/Pulsar/Services/{Service}/Modules/{Module}/Controllers/{Name}.php- Generator command
make:controller- Workflow method
- None
- Stability
- Current manifest surface (Pulsar 0.4.1)
Canonical example
Generated src/stubs/controller-plain.stub — canonical synchronized stub.
<?php
namespace {{namespace}};
use Illuminate\Routing\Controller;
/**
* {{name}} Controller
*
* Handles HTTP delivery for the {{module}} module in the {{service}} service by delegating to UseCases.
*/
class {{name}} extends Controller
{
//
}
Responsibility
Controller owns the responsibility stated above; it must not absorb delivery, transaction, or unrelated cross-layer behavior.
Placement and dependencies
Keep this type in its generated Service Module path. It may depend inward on Domain capability, but it must not make another Service its behavioral dependency.
Workflow and tests
Controller is an inbound adapter: establish the delivery boundary, then call one UseCase. Test its direct contract, its rejected boundary cases, and the caller or callee that proves the rule in application flow.
Three pitfalls
- ❌ Prohibited: move this responsibility into a neighboring type merely because it is nearby.
- ✅ Correct: keep the generated placement and depend only on the documented layer direction.
- ✅ Correct: test the boundary through the caller and the return or side effect visible to its callee.
Related reading
Read architecture placement for shared rationale and follow this page’s related concept links for the adjacent responsibility.
Boundaries
❌ Prohibited: Do not call a Query, Action, or Operation directly from a Controller.
✅ Correct: Call exactly one UseCase, then assemble only the HTTP response.