Laravel Tutorial 001 Main Concepts

Laravel Tutorial 001 Main Concepts

Post Date : 2024-03-01T22:07:05+07:00

Modified Date : 2024-03-01T22:07:05+07:00

Category: laravel-tutorial

Tags: laravel , php

The 1st step, create new laravel project with composer

composer create-project laravel/laravel example-app

Topics will be go through

Laravel Atoms

  1. Request Flow
  2. Service Containers
  3. Service Providers
  4. Facades

Go through all basic concepts via “Todo Application”

Overview Architecture

image

require __DIR__.'/../vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/

$app = require_once __DIR__.'/../bootstrap/app.php';

$kernel = $app->make(Kernel::class);

$response = $kernel->handle(
    $request = Request::capture()
)->send();

$kernel->terminate($request, $response);

Laravel Atoms

  1. Environment
  • Laravel use dotenv to load env variables. By default the dotenv will use “.env” file.

Any variable in your .env file can be overridden by external environment variables such as server-level or system-level environment variables.

Laravel will attempt to load .env.[APP_ENV] file if existed, if not the default is .env file.

You Might Also Like