ప్రతి Laravel request ఒకే front controller, public/index.php గుండా ప్రవేశిస్తుంది, HTTP Kernel ద్వారా ఒక స్టాక్ మరియు గుండా ఒక కు నడపబడుతుంది, మరియు ఒక ను తిరిగి ఇస్తుంది — ఆ తర్వాత middleware నడుస్తుంది.
ప్రతి Laravel request ఒకే front controller, public/index.php గుండా ప్రవేశిస్తుంది, HTTP Kernel ద్వారా ఒక స్టాక్ మరియు గుండా ఒక కు నడపబడుతుంది, మరియు ఒక ను తిరిగి ఇస్తుంది — ఆ తర్వాత middleware నడుస్తుంది.
Responsepublic/index.php ── autoload + app ను bootstrap చేయి
▼
HTTP Kernel::handle($request)
▼
Bootstrappers ── env, config, providers (register + boot)
▼
Global middleware ── (TrustProxies, HandleCors, ...)
▼
Router dispatch ── route సరిపోల్చు
▼
Route / group middleware ── (auth, throttle, verified, ...)
▼
Controller (లేదా closure) ── మీ logic → ఒక Response ను తిరిగి ఇస్తుంది
▼
Response ──▶ client
▼
Kernel::terminate ── terminable middleware (ఉదా. session సేవ్, logging)
index.php Composer autoload ను లోడ్ చేసి application container ను bootstrap చేస్తుంది.Request ను స్వీకరించి bootstrappers ను నడుపుతుంది: env + config ను లోడ్ చేయి, service providers ను register చేసి boot చేయి (ఇక్కడే framework మరియు మీ bindings అనుసంధానమవుతాయి).auth, throttle, verified) controller కు ముందు నడుస్తుంది; ప్రతి ఒక్కటి ముందుగానే ఆపవచ్చు.Response (view, JSON, redirect) ను తిరిగి ఇస్తుంది. response తిరిగి బయటికి వచ్చేటప్పుడు middleware యొక్క "after" logic నడుస్తుంది.Kernel::terminate వాయిదా వేసిన పని కోసం terminable middleware ను నడుపుతుంది.// app/Http/Middleware/Timing.php → 3/5. middleware
public function handle($request, Closure $next)
{
$request->attributes->set('started', microtime(true));
$response = $next($request); // తదుపరి layer / controller కు పంపు
$response->headers->set('X-Time', '...'); // "after" logic
return $response;
}
// routes/web.php → 4. routing (+ middleware)
Route::get('/items/{id}', [ItemController::class, 'show'])->middleware('auth');
// app/Http/Controllers/ItemController.php → 6. controller
public function show(int $id)
{
return response()->json(Item::findOrFail($id));
}
Laravel యొక్క lifecycle service container మరియు middleware pipeline చుట్టూ నిర్మించబడింది, కాబట్టి క్రమాన్ని తెలుసుకోవడం — bootstrap/providers, తర్వాత global middleware, తర్వాత routing, తర్వాత route middleware, తర్వాత controller, తర్వాత terminate — auth, rate limiting, CORS, మరియు cleanup ఎక్కడ ఉండాలో ఖచ్చితంగా చెబుతుంది. ఒక service inject చేయబడటానికి ముందు ఒక provider లో ఎందుకు bind చేయాలో, మీ controller నడవడానికి ముందు throttle ఒక request ను ఎందుకు తిరస్కరిస్తుందో, మరియు వినియోగదారు వేచి ఉండకుండా నెమ్మదైన పనిని terminable middleware కు ఎలా వాయిదా వేయాలో ఇది వివరిస్తుంది.
జూనియర్ నుండి సీనియర్ వరకు వివరణాత్మక సమాధానాలతో IT ఇంటర్వ్యూ ప్రశ్నల లైబ్రరీ.
విరాళం