Laravel code bright

Source: Internet
Author: User
Tags autoload

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 shoshould 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
These in detail right now as that may cause unnecessary confusion. Instead you shoshould 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 shocould 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 shocould 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
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 M 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 deployments 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
Shocould 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
Ages.
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 in all of the unit and acceptance tests for your application. The default
PHP unit configuration that has been encoded 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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.