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
The 1st step, create new laravel project with composer
composer create-project laravel/laravel example-app
Topics will be go through
Laravel Atoms
- Request Flow
- Service Containers
- Service Providers
- Facades
Go through all basic concepts via “Todo Application”
Overview Architecture
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
- 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.