use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; class ExampleController extends AbstractController { public function index() { $data = ['name' => 'John', 'age' => 30]; return $this->render('example/index.html.twig', [ 'data' => $data, ]); } }
namespace App\Http\Controllers; use Illuminate\Http\Request; class ExampleController extends Controller { public function index() { $data = ['name' => 'John', 'age' => 30]; return view('example.index', ['data' => $data]); } }In this example, we create a new controller instance called `ExampleController` that extends the `Controller` class provided by the Laravel package library. We define a method called `index` that returns a response with a rendered Blade template and some data. In both examples, we instantiate a controller instance that receives a request from the view layer, processes some data, and sends a response back to the view layer. The package libraries used in the examples are Symfony and Laravel, respectively.