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 ...
随机推荐
- [转] sql数据类型 varchar与nvarchar的区别
SQL Server提供两种数据类型来存储字符信息.在如何在SQL Server或应用程序中使用方面,这两种数据类型大致是一样的.差别在于nvarchar是用于存储处理数据库图表中多语言数据的Unic ...
- Could not find artifact com.sun:tools:jar:1.5.0解决方法
可以参照在XP系统下搭建maven环境出的问题 Unable to locate the Javac Compiler in: C:\Program Files\Java\jre6\..\lib\to ...
- Where does Windows store MSI files for uninstallation?
Original link: Where does Windows store MSI files for uninstallation? Following content are only use ...
- Linux C 程序 基础(FOUR)
1.标识符:C语言本身不限制变量长度,但是某些编译器会限制变量长度,命名最好不要超过8位. 以数字开头,保留字,*,空格非法 2.关键字:类型说明符,int , 语句定义符,if el ...
- Linux CPU亲缘性详解
前言 在淘宝开源自己基于nginx打造的tegine服务器的时候,有这么一项特性引起了笔者的兴趣.“自动根据CPU数目设置进程个数和绑定CPU亲缘性”.当时笔者对CPU亲缘性没有任何概念,当时作者只是 ...
- [原创整理]这些术语你知道吗?(Web篇)
每一个术语代表的或是一种技术,或是一项标准,那么,作为混在IT界这个江湖的你,对这些术语熟悉么? 你知道它们所指代的事物么?你知道他们被创造的目的么?你了解了设计者的思想与精髓了么?亲,跟上时代的脚步 ...
- ubuntu漂亮主题
桌面看腻了?试试这 4 款漂亮的 Linux 图标主题吧 http://linux.cn/article-4332-1.html Flatabulous https://github.com/anmo ...
- 【Django】基于Django架构网站代码的目录结构
经典的Django项目源码目录结构 Django在一个项目的目录结构划分方面缺乏必要的规范.在Django的官方文档中并没有给出大型项目的代码建议目录结构,网上的文章也是根据项目的不同结构也有适当的 ...
- 关于ASE日志空间示数不正常的解决办法
最近某系统的ASE数据库出现了异常,经过各种努力,终于把数据库正常又起起来了.但是经过检查,发现在查看剩余日志空间的时候(sp_helpsegment 'logsegment'),发现显示出来 ...
- IOS开发—IOS 8 中设置applicationIconBadgeNumber和消息推送
摘要 在IOS7中设置applicationIconBadgeNumber不会有什么问题,但是直接在IOS8中设置applicationIconBadgeNumber会报错 因为在IOS8中要想设置a ...