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 ...
随机推荐
- 国外一些知名ASP.Net开源CMS系统
1.Ludico Ludico是C#编写的居于ASP.NET 2.0的Portal/CMS系统.它的模块化设计是你可以按照你希望的使用或开发网站功能.它里面有高级的用户管理,一个所见即所的(WYSIW ...
- 自定义函数实现NULL值替换
数据库环境:SQL SERVER 2005 有时候,想将查询查询数来的数据格式化一下,不希望显示NULL值,或者复制表的数据时,被插入的表不允许有NULL. 我们可以通过ISNULL()函数或者COA ...
- 三分钟学会CSS3中的FLEXBOX布局
原文地址,保护版权,请勿转载:http://page.factj.com/blog/p/2574 这篇文章里我们将学习CSS里flexbox布局的几个最重要的概念,通过学习flexbox布局,你会发现 ...
- Map 对象
1.创建一个Map对象 var map=new Map(); 2.size属性 //给map添加一些值 map.set("name","张三"); map.se ...
- java集合 collection-list-LinkedList 模拟一个堆栈或者队列数据结构。
/* 使用LinkedList模拟一个堆栈或者队列数据结构. 堆栈:先进后出 如同一个杯子. 队列:先进先出 First in First out FIFO 如同一个水管. */ import jav ...
- 如何从零开始实现一个soa远程调用服务基础组件
说起soa远程调用基础组件,最著名的莫过于淘宝的dubbo了,目前很多的大型互联网公司都有一套自己的远程服务调用分布式框架,或者是使用开源的(例如dubbo),或者是自己基于某种协议(例如hessia ...
- [getLongestLength] 加和为0的最长子串长度
点击这里查看原文 假设一个数组仅仅由1和-1组成,求该数组的和为0的最长子串的长度. 例如: {1,-1,1,-1,1,1,1} 输出:4. 昨天机试的时候做到这道题,不会做,今天思考一下. 普通的解 ...
- WebClient以POST方式发送Web请求
本例使用WebClient以POST方式发送Web请求并下载一个文件,难点是postData的构造,发送Web请求时有的网站要求可能要求 Cookies前后一致.其中application/x-www ...
- DELPHI 取文件名和扩展名
x:=ExtractFileName(str); //取文件名+扩展名,不包含文件路径 y:=ExtractFileExt(str); //取文件的扩展名
- 关于SQL优化的一个小试例子
原SQL: select ta.serialno, ta.accepttime, ta.subsnumber, ta.subsname, ta.cont ...