title: Controller in Clean Architecture
body: <p>I'm trying to apply <a href="https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html" rel="noreferrer">Clean Architecture</a> from uncle Bob in Laravel application.</p>
  
  <p>What i'm concerning is: As uncle Bob describe, <strong>the Controller should belongs to third circle: Interface Adapters</strong> (from inside-out). It means the Controller only depends on Use Case Circle (2nd), and should not know anything about the framework in 4th circle.</p>
  
  <p>But controller in some frameworks has to extends a base class (for example, an AbstractController class), It also needs to receive an Request object and sometimes return a Response object, so this kinda <strong>break the dependency rule</strong> of Clean Architecture, as it knows about the framework in the outer circle.</p>
  
  <p>Do i misunderstand? If not is there any solution to not break <strong>the dependency rule</strong>?</p>
  
  <p>My controller is looking like this:</p>
  
  <pre><code>use Illuminate\Http\Request;
  use Illuminate\Routing\Controller;
  use User\UseCase\FetchUsers;
  use User\UseCase\FetchUsersRequest;
  
  class UserController extends Controller
  {
      public function index(Request $request, FetchUsers $fetchUsersUseCase)
      {
          $useCaseRequest = new FetchUsersRequest(
              // extract data from Request
          );
  
          $useCaseResponse = $fetchUsersUseCase-&gt;handle($useCaseRequest);
  
          return [
              'users' =&gt; $useCaseResponse-&gt;users,
          ];
      }
  }
  </code></pre>