zoukankan      html  css  js  c++  java
  • laravel code bright

    Project Root
    Let’s start by taking a look at the root folder structure.
    • app/
    • bootstrap/
    • vendor/
    • public/
    • .gitattributes
    • .gitignore
    • artisan
    • composer.json
    • composer.lock
    • phpunit.xml
    • server.php

    bootstrap
    • autoload.php
    • paths.php
    • start.php
    The bootstrap directory contains a few files that relate to the startup procedures of the framework.
    The autoload.php file contains most of these procedures, and should only be edited by experienced
    Laravel users.
    The paths.php file builds an array of the common filesystem paths that are used by the framework.
    If for some reason you decide to alter the directory structure of the framework packages, you may
    need to alter the contents of this file to reflect your changes.
    The start.php file contains more startup procedures for the framework. I don’t want to dig into
    these in detail right now as that may cause unnecessary confusion. Instead you should probably
    take note that framework environments can be set here. If you don’t know what the environments
    are used for then don’t worry. We will cover that later!
    Simply put, the contents of the bootstrap directory should only be edited by experienced Laravel
    users who need to alter the shape of the framework on the filesystem. If you are new to Laravel,
    then just ignore it for now, but don’t delete it! Laravel needs this directory to function.

    vendor
    The vendor directory contains all of the composer packages that are used by your application. This,
    of course, includes the Laravel framework package. For more information about this directory please
    refer back to the Composer primer chapter.

    public
    • packages/
    • .htaccess
    • favicon.ico
    • index.php
    • robots.txt
    The public directory should be the only web facing directory of a Laravel application. It’s normally
    where your assets such as CSS, Javascript files and images will live. Let’s have a closer look at the
    contents.

    The packages directory will be used to contain any assets that need to be installed by third party
    packages. They are kept in a separate directory so that they don’t conflict with our applications own
    assets.

    The Application Directory
    Here is where your application will take its shape. It is the directory in which you will spend most
    of your time. For that reason, why don’t we get better acquainted with it?
    • commands/
    • config/
    • controllers/
    • database/
    • lang/
    • models/
    • start/
    • storage/
    • tests/
    • views/
    • filters.php
    • routes.php

    commands
    The commands directory contains any custom artisan command line interface commands that are
    required by your application. You see the Artisan CLI not only provides default functionality to help
    you build your project, but you may also create custom commands to do your bidding.
    config
    The configuration for both the framework and your application are kept within this directory.
    Laravel’s configuration exists as a set of PHP files containing key-value arrays. This directory
    will also contain sub directories which allow for different configurations to be loaded in different
    environments.
    controllers
    As the name suggests, this directory will hold your controllers. Controllers can be used to provide
    application logic, and to glue the separate parts of your application together. This directory has been
    added to the default composer.json as a classmap autoload location for your convenience

    database
    Should you choose to use a database as a method of long term storage, then this directory will be
    used to hold the files that will create your database schema, and methods for seeding it with sample
    data. The default SQLite database is also located in this directory.
    lang
    The lang directory contains PHP files with arrays of strings that can be used to provide localisation
    support to your application. Sub folders named by region allow for string files to exist for multiple
    languages.
    models
    The models directory will contain your models. Surprised? Models are used to represent your
    business model, or provide interaction with storage. Confused? Don’t worry. We will cover models
    in detail in a later chapter. Know that a User model has been provided for you to enable application
    authentication ‘out of the box’. Like the controllers directory, this has been added to the classmap
    autoload section of the default composer.json.
    start
    Where the bootstrap directory contains the startup procedures that belong to the framework,
    the start directory contains startup procedures that belong to your application. As always, some
    sensible defaults have been provided for you.
    storage
    When Laravel needs to write anything to disk, it does so within the storage directory. For this
    reason your web server must be able to write to this location.

    tests
    The tests directory will contain all of the unit and acceptance tests for your application. The default
    PHP Unit configuration that has been included with Laravel, will look for tests within this directory
    by default.
    views
    The views directory is used to contain the visual templates for your application. A default hello
    view has been provided for your convenience.
    filters.php
    The filters.php file is used to contain the route filters for your application. You will learn more
    about filters in a future chapter.
    routes.php
    The routes file contains all of the routes for your application. You don’t know what routes are? Well,
    let’s not waste any more time then. Onwards to the next chapter!

  • 相关阅读:
    2020去奔跑
    2020前两个月学习心得
    2020年1_2月寒假学习心得
    寒假中期考核个人总结
    Numpy、Matplotlib和pandas学习路线引导
    Python学习路线引导-Python入门基础
    2019在路上
    2020/11/28助教一周小结(第九周)
    2020/11/3助教一周小结(第五周)
    2020/10/25助教一周小结(第四周)
  • 原文地址:https://www.cnblogs.com/youxin/p/3853593.html
Copyright © 2011-2022 走看看