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!
laravel code bright的更多相关文章
- 50分钟学会Laravel 50个小技巧
50分钟学会Laravel 50个小技巧 时间 2015-12-09 17:13:45 Yuansir-web菜鸟 原文 http://www.yuansir-web.com/2015/12/09 ...
- 50分钟学会Laravel 50个小技巧(基于laravel5.2,仅供参考)
转载请注明:转载自 Yuansir-web菜鸟 | LAMP学习笔记 本文链接地址: 50分钟学会Laravel 50个小技巧 原文链接:< 50 Laravel Tricks in 50 Mi ...
- Laravel 精选资源大全
原文链接 必备品 文档:Documentation API:API Reference 视频:Laracasts 新闻:Laravel News 中文文档 Laravel学院– Laravel 5. ...
- Github上的1000多本免费电子书重磅来袭!
Github上的1000多本免费电子书重磅来袭! 以前 StackOverFlow 也给出了一个免费电子书列表,现在在Github上可以看到时刻保持更新的列表了. 瞥一眼下面的书籍分类目录,你就能 ...
- Github 的一个免费编程书籍列表
Index Ada Agda Alef Android APL Arduino ASP.NET MVC Assembly Language Non-X86 AutoHotkey Autotools A ...
- laravel route路由,视图和response和filter
Laravel充分利用PHP 5.3的特性,使路由变得简单并富于表达性.这使得从构建API到完整的web应用都变得尽可能容易.路由的实现代码在 application/routes.php 文件. 和 ...
- php框架推荐
ThinkPHP, 国内开发的框架,特别容易入门,中文文档细致,表述准确. Laravel, 国外框架,非常高级的一个框架,特别是前端比较模块化,但入门难一些,速度不高. laravel在lampp ...
- Laravel5.5 的 Homestead 开发环境部署
首先明白以下几个概念 VirtualBox -- Oracle 公司的虚拟机软件, 能运行在当前大部分流行的系统上; Vagrant 提供一种命令行接口, 允许自动化安装虚拟机, 并且因为是脚本编写 ...
- 使用 visualstudio code 编辑器调试执行在 homestead 环境中的 laravel 程序
由于之前做 .net 开发比较熟悉 visualstudio,所以自 visualstudio code 发布后就一直在不同场合使用 vscode ,比如前端.node等等.最近在做 laravel ...
随机推荐
- SQLite 入门教程(一)基本控制台(终端)命令
一.基本简介 SQLite 是一个自持的(self-contained).无服务器的.零配置的.事务型的关系型数据库引擎.因为他很小,所以也可以作为嵌入式数据库内建在你的应用程序中.SQLite 被应 ...
- Linux下chkconfig命令详解即添加服务以及两种方式启动关闭系统服务
The command chkconfig is no longer available in Ubuntu.The equivalent command to chkconfig is update ...
- 如何防止SWF文件被反编译
这篇文章的标题所提出的问题的答案是“不可能”.至少对我来说是不可能的.借助适当的工具,我们可以反编译任何SWF文件.所以,不要将重要的信息置于SWF文件中.SWF文件中不要包含个人的帐号或者密码. 我 ...
- 自定义popupmenu菜单背景色
procedure TForm1.N11DrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect; Selected: Boolean); be ...
- ora 32021 设置参数时参数值长度超过255处理办法
alter system set db_file_name_convert='AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA-.' scope=spfi ...
- java集合 collection-list-vector
import java.util.*; /* 枚举就是Vector特有的取出方式. 发现枚举和迭代器很像. 其实枚举和迭代是一样的. 因为枚举的名称以及方法的名称都过长. 所以被迭代器取代了. 枚举郁 ...
- 写入.csv文件
#include "stdafx.h" #include "WriteCsv.h" CString m_strData;//写入记录的一条数据 CString ...
- HDOJ 1042 N! -- 大数运算
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1042 Problem Description Given an integer N(0 ≤ N ≤ 1 ...
- 浅析JAVA设计模式(一)
第一写技术博客,只是想把自己一天天积累的东西与大家分享.今天在看<大型网站架构和java中间件>这本书时,其中提到代理模式的动态代理.作为java中间件的一个重要基础,我觉的有必要整理和分 ...
- HTML5 Video与Audio 视频与音频
---- 视频Video对象 - 指定视频播放地址 <video width="320" height="240" controls="cont ...