laravel项目结构_Laravel项目的项目结构

laravel项目结构

Open your project: At first, we will see the main directories which we are using the most and which are useful.

打开您的项目:首先,我们将看到我们使用最频繁且最有用的主目录。

Projects:

项目:

  • Database create

    数据库创建
  • Managing reservation in hotel

    管理酒店预订
  • Setting up an authentication layer

    设置认证层
  • Basic CRUD

    基本增删改查
  • Laravel is easy to move from one product to another.

    Laravel很容易从一种产品转移到另一种产品。

1) Pre-defined laravel files: a couple of directories with some root-level files.

1)预定义的laravel文件:几个目录和一些根目录文件。

2) app directory:

2)应用目录:

  • console: It is a command-line interface in Laravel.控制台:这是Laravel中的命令行界面。
  • Laravel is an MVC framework where model access the database, views present the front end for our end-user and controller lives in between two.

    Laravel是一个MVC框架,模型可以在其中访问数据库,视图为我们的最终用户和控制器提供了前端,它们位于两者之间。
laravel项目结构_Laravel项目的项目结构

Now, let us learn about all the important directories which we have to use to create a Laravel project.

现在,让我们了解创建Laravel项目必须使用的所有重要目录。

1) Exception directory: This directory contains the application of an exception handler. Here, we can add any custom exception as well as custom logic for handling an exception. Handler.php file is an exception handling file that automatically, finds an error and shows you on the browser.

1)异常目录:此目录包含异常处理程序的应用程序。 在这里,我们可以添加任何自定义异常以及用于处理异常的自定义逻辑。 Handler.php文件是一个异常处理文件,它会自动,查找错误并在浏览器上显示。

2) http: It contains all the request middleware and controllers. it is big in comparison to the similar / other files. it is accessed from the web browser.

2)http:它包含所有请求中间件和控制器。 与同类/其他文件相比,它很大。 可从Web浏览器访问它。

    • middleware

      中间件
    • view composer

      查看作曲家
    • view creators

      查看创作者
    • all binds of goodies

      所有的东西


  • laravel项目结构_Laravel项目的项目结构




  • laravel项目结构_Laravel项目的项目结构


  • Provider: It contain user model. In this we can hook custom logic into our laravel application at a global level. 提供者:包含用户模型。 在这种情况下,我们可以在全局级别将自定义逻辑挂接到laravel应用程序中。
    • user.php: User model are already created and another project models are also placed here (under provider directory).user.php :用户模型已经创建,另一个项目模型也放置在此处(在provider目录下)。

3) Bootstrap: It configure bootstrap and bootstrap framework auto-loading and catch. It is used to load our application.

3)Bootstrap:它配置bootstrap和bootstrap框架的自动加载和捕获。 它用于加载我们的应用程序。

4) Config: It contains all the application files like HTML, image, view. Editor config/config file is similar to PHP configuration file. config is where we will control the configuration of our application.

4)配置:它包含所有应用程序文件,如HTML,图像,视图。 编辑器config / config文件类似于PHP配置文件。 config是我们将控制应用程序配置的位置。

  • app.php: for illuminate html, forms, views we use app.php :为了阐明html,表格和视图,我们使用app.php file. app.php文件。



    laravel项目结构_Laravel项目的项目结构




    laravel项目结构_Laravel项目的项目结构
  • database.php: for databasedatabase.php:用于数据库

    connections: different types of database connections are there and here we use MySQL. If you want to use a different database then its connection is also there. we have to set DB, DB_name and password for the connection. 连接:存在不同类型的数据库连接,在这里我们使用MySQL。 如果要使用其他数据库,则它的连接也存在。 我们必须为连接设置DB,DB_name和密码。



    laravel项目结构_Laravel项目的项目结构


  • mail.php: It makes the configuration of sending email to any file by setting driver, host, port, name, password, etc. mail.php:通过设置驱动程序,主机,端口,名称,密码等,进行将电子邮件发送到任何文件的配置。



    laravel项目结构_Laravel项目的项目结构


  • view.php: Here, the base path is given. It indicates the view page whatever view you want to show to the users. view.php:这里给出了基本路径。 它指示视图页面要显示给用户的任何视图。



    laravel项目结构_Laravel项目的项目结构


4) database: It is where we will be set up our databases into base save and other migrations which give us the ability to essentially version database.database --> * factories, * migration, *seeds

4)数据库 :在这里我们将数据库设置为基本保存和其他迁移,这使我们能够对数据库进行本质上的版本化。数据库-> * factory,* migration,* seeds

5) public: It is for the public where public resources will be stored. like: CSS,js and other application files.

5)public :用于存储公共资源的公共场所。 像:CSS,js和其他应用程序文件。

6) resources: It is an unmagnified version of our CSS and js as well as the 'views' files that contain HTML.

6)资源 :这是CSS和js以及包含HTML的“视图”文件的未放大版本。

Unmanified CSS and js: Removing unnecessary lines and spaces in the source code of a page without changing their functionality.

Unmanified CSS and js :无需更改页面功能即可删除页面源代码中不必要的行和空格。

7) routes: It contains routes of our application.

7)路线 :它包含我们应用程序的路线。

8) storage: It is used to stores any long term files such as log and coaching files.

8)存储 :用于存储任何长期文件,例如日志和指导文件。

9) tests: It contains the test files for testing the application.

9)测试 :它包含用于测试应用程序的测试文件。

10) vendor: This is the directory where the composer installs the various packages we need to make our PHP application work.

10)vendor :这是作曲家安装目录的目录,我们需要使用这些软件包才能使PHP应用程序正常工作。

Note: Here .env file is our working file which is known as environment file.

注意: .env文件是我们的工作文件,称为环境文件。

Conclusion:

结论:

In this article, we have learned about different directories in the project in laravel framework. We will know more about it in the upcoming article. Have a nice day! Happy Learning!

在本文中,我们了解了laravel framework项目中的不同目录 。 我们将在下一篇文章中了解更多信息。 祝你今天愉快! 学习愉快!

翻译自: https://www.includehelp.com/laravel/project-structure-of-laravel-project.aspx

laravel项目结构