how to install laravel composer in windows 10
1. Install composer Composer (getcomposer.org)
2. Install laravel in htdocs
composer create-project laravel/laravel example-app
3. open cmd in larvel app (example-app) directory and type command
php artisan serve
Request Life cycle:
- All requests goto public/index.php by webserver its load composer autoload, create $app instance from bootstrap/app.php
- Next, the incoming request is sent to either the HTTP kernel (app/Http/Kernel.php) or the console kernel. It configure error handling, configure logging, detect the application environment, defines a list of HTTP middleware (eading and writing the HTTP session, maintenance mode, verifying the CSRF token)
- handle method is quite simple: it receives a Request and returns a Response.
- One of the most important kernel bootstrapping actions is loading the service providers. Service providers are responsible for bootstrapping all of the framework's various components, such as the database, queue, validation, and routing components
- Routing
- Response travels>middleware, >kernel's handle method returns the response object>index.php calls send method on the returned response.
- The send method sends the response content to the user's web browser.
Configrations:
All configrations are insdie config folder.
php artisan about
Encrypt env for security purpose and save the key
php artisan env:encrypt
To decrypt
php artisan env:decrypt --key=3UVsEgGVK36XN82KKeyLFMhvosbZN1aF
APP structure
>http folder contains models,controllers and middlewares
> database contain migration (auto create tables), seeders (add data auto into tables),
> public folder contains assets
> resources contains views and front end files
> routes contain url structure
> storage contain uploaded files
>vendor contain libraries
LIFE CYCLE
It loads rest of framework ie composer generated autoloaders
>public/index.php
then retrieves an instance of the Laravel application from bootstrap/app.php inside index.php
$app = require_once __DIR__.'/../bootstrap/app.php';
NEXT >Kernal run before request is executed, Request is sent to http kernal or console kernal using the handleRequest or handleCommand
kernal also handle sessions, maintence mode, verify csrf token, etc using middlewares
handle method receives a Request and returns a Response
$kernel = $app->make(Kernel::class);
NEXT> Service providers are loaded, ie database, validation , queue, etc. Laravel iterate through this list of providers and instantiate each of them.Then > register() method will be called on all of the providers to register. then boot() method will be called on each provider.
Next> Once the application has been bootstrapped and all service providers have been registered, the Request will be handed off to the router for dispatching.
Once the route or controller method returns a response, the response> route's middleware> HTTP kernel's handle() method returns the response object to the handleRequest of the application instance, and this method calls the send() method on the returned response. The send method sends the response content to the user's web browser.
==========================
I would like to request the implementation of Two-Factor Authentication (2FA) on the Admin Panel only. Only admins will need to enter the verification code. There is no need to enable 2FA for regular users.