Field Manual PHP / Laravel reference
← Engineering

Separation of concerns

Separate HTTP, business rules, storage, and presentation responsibilities.

What it is

Separate HTTP, business rules, storage, and presentation responsibilities.

When to use it

Reduce coupling and allow business tests without a web request.

Syntax

HTTP boundary != domain rule != persistence != rendering

Example

// HTTP controller invokes an operation:
$result = $transferService->move($actor, $sourceId, $destinationId, $amountCents);
// Service accepts typed/domain inputs, not the whole Request.

Common mistakes

Moving a giant controller into a giant service does not establish clear responsibilities.

Related topics

Browse Engineering