bootstrap/start.php file will be loaded. This file creates Application object, which also serve as an IoC container. enviornment detection will be performed.
Internal framework/start.php file configures settings, and load each Service Provider’s register method. (Each service provider binds one or more closure into the container, which allows you to access those bound services within your application.)
app/start files will be loaded.
app/routes.php file is loaded.
Request object sent to Application, which returns Response object.
Response object sent back to client.
app/start
app/start files: serve as a simple place to place any “bootstrapping” code. you could register a View composer, configure your logging preferences, set some PHP settings, etc. It’s totally up to you. It contains:
global.php(the registration of Logger, the inclusion of your app/filters.php, etc.). local.php, artisan.php.
You may also do pre and post request processing by registering before, after, finish, and shutdown application events. Listeners to these events will be run before and after each request to your application.
You may also register a listener on the matched event, which is fired when an incoming request has been matched to a route but that route has not yet been executed:
(The finish event is called after the response from your application has been sent back to the client. This is a good place to do any last minute processing your application requires. The shutdown event is called immediately after all of the finish event handlers finish processing, and is the last opportunity to do any work before the script terminates. Most likely, you will not have a need to use either of these events.)
Routing
In app/routes.phpfile. The simplest Laravel routes consist of a URI and a Closure callback.
Basic usage including get, post, any HTTPs, etc.
Route filters provide a convenient way of limiting access to a given route, which is useful for creating areas of your site which require authentication. There are several filters included in the Laravel framework, including an auth filter, an auth.basic filter, a guest filter, and a csrf filter. These are located in the app/filters.php file.
First, defining A Route Filter
If the filter returns a response, that response is considered the response to the request and the route will not execute. Any after filters on the route are also cancelled.
Attaching Filter(s) To A Route, A Controller Action
Could also Specifying Filter Param
Registering A Class Based Filter
Named Routes
Route Model Binding
Sometimes you may need to apply filters to a group of routes.
Since we have bound the {user} parameter to the User model, a User instance will be injected into the route. So, for example, a request to profile/1 will become {user} = 1, i.e. inject the User instance which has an ID of 1.
Request and Input
Cookies
Files
Request Information
Response
A Response instance inherits from the Symfony\Component\HttpFoundation\Response class, providing a variety of methods for building HTTP responses.
Redirects
View
There is no view in our project, but let me put a basic view in it.
Special Response
Controller
Controllers can group related route logic into a class, as well as take advantage of more advanced framework features such as automatic dependency injection.
Controllers are typically stored in the app/controllers directory, and this directory is registered in the classmap option of your composer.json file by default. User-defined controller which is in other directory needs to register manually.
Route declarations are not dependent on the location of the controller class file on disk. So, as long as Composer knows how to autoload the controller class, it may be placed anywhere you wish.
A basic controller class:
Controller class with filter
Security
Config: app/config/auth.php, for tweaking the behavior of the authentication facilities.
By default, Laravel includes a User model in your app/models directory which may be used with the default database Eloquent authentication driver.
Dependency injection: a method of removing hard-coded class dependencies. Instead, the dependencies are injected at run-time, allowing for greater flexibility as dependency implementations may be swapped easily.
They prepare your application to actually handle requests, and usually need to be executed before a route or controller is actually called.
Like most other bootstrap code, the start files are always an option for registering IoC bindings. Alternatively, you could create an app/ioc.php (filename does not matter) file and require that file from your start file.