Laravel- directory structure

1 Introduction

Laravel (This version 5.4) as a framework for the development of natural and other frameworks have their own directory structure. And in particular a clear framework directory Laravel arranged for all types of project development. We should learn a framework to understand the fundamental affirmation of his principles and directory structure, each layer in the MVC know what resources in any place where grass-roots class, including the extension and so on. . . , Then we have to talk about this issue of the directory structure.

2. root directory

 

 

 


a central app store application code, including M and C layers we know the MVC pattern.

  Console directory contains all the Artisan command Laravel used, are not familiar with Artisan students can click to find out. app directory of many types can be generated directly by using the command includes the familiar controller and the model class in the terminal.

  Events directory is the place to put the event class, event notification can be used for applications other parts of the given action has taken place, and flexible decoupling process. As for decoupling we do not mention this, you can understand it as a link but not very direct contact with the binding of the event together.

  Exception directory that contains the exception handler applications, colleagues can also handle applications thrown.

  Http key directory is a directory that contains the controller, filters and other requests. And middleware Middleware and routing files route.php. There is a controller and includes a middleware class model can be generated directly by the above command artisan.

  Jobs directory is a place to put the task queue, application tasks can be queued, may also request life cycle synchronization executed in the current.

  Listeners directory includes a processor-based event, and event processor receives a logic provided after the event.

  Policies git directory contains a file handle.

  Providers directory contains some empty process.

route.php route file, passes the request through the M layer to the C layer is formed by routing calls middleware.

directory files that contain a bootstrap for starting and automatic loading frame configuration, there is generated a cache folder frame for containing the boot files to improve performance; Laravel cache caching mechanism is particularly severe, may beg nice The controller can be cached.

config directory to store the frame in a series of configuration files, including database (databases.php, etc.), here to show that you do not configure database information in this document databases.php, because a lot of people will put their works shared git it. If you configure database information in this file may result in information disclosure or the boring people as a tool to attack the database. laravel root directory has a .env file. You can configure the database here, when you upload the file git when will filter out. git default does not display the file. Effective protection of the confidence in the safety of users.

public directory to store the file index.php frame the entrance and store some resources, such as js, css, pictures or video. Here mention if you have not added to modify the configuration file or no modification server.php at the root of the root directory when you remember to configure the project to the next public directory.

Front page resouces directory holds the project's location is in the resources below views, that is, the V MVC layer.

storage directory contains the compiled template Blade, based on the session, a cache file, and other files generated by the frame, which folder is segregated into app, framework and logs directory, app

File directory to be used for storing applications, Framework directory for storing files and the frame buffer generated, and finally, the log file contains the logs directory application;

tests directory contains automated testing, which includes PHPUntil instance for immediate use.

Vendor directory is very important to a directory that contains dependent Composer, which is extended and the content of some core classes are in the framework here.

Guess you like

Origin www.cnblogs.com/superzwb/p/11855803.html