在安装laravel的时候,我们一般是download github上的laravel/laravel,随后执行composer install,在这个过程中,你会发现composer其中的一项工作是

安装laravel/framework到vendor目录中,(为了看清楚这个过程,我们可以执行composer install --dry-run模拟安装dependency的过程)。那么laravel/laravel和laravel/framework到底是什么关系呢?

(背景知识: laravel/laravel, laravel/framework被称为github shorthand,实际上对应着github上的git repo。下面是类似composer的bower package manager安装一个front end package时的情景:

# registered package
$ bower install jquery
# GitHub shorthand
$ bower install desandro/masonry
# Git endpoint
$ bower install git://github.com/user/package.git
# URL
$ bower install http://example.com/script.js

)

 (master)*$ composer install --dry-run
Warning: This development build of composer is over days old. It is recommended to update it by running "/usr/local/bin/composer self-update" to get the latest version.
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing vlucas/phpdotenv (v1.1.1) - Installing symfony/var-dumper (v2.6.9) - Installing symfony/translation (v2.6.9) - Installing symfony/security-core (v2.6.9) - Installing symfony/routing (v2.6.9) - Installing symfony/process (v2.6.9) - Installing psr/log (1.0.) - Installing symfony/debug (v2.6.9)
- Installing symfony/http-foundation (v2.6.9) - Installing symfony/event-dispatcher (v2.7.0) - Installing symfony/http-kernel (v2.6.9) - Installing symfony/finder (v2.6.9) - Installing symfony/console (v2.6.9) - Installing swiftmailer/swiftmailer (v5.4.0) - Installing jakub-onderka/php-console-color (0.1) - Installing jakub-onderka/php-console-highlighter (v0.3.1) - Installing dnoegel/php-xdg-base-dir (0.1) - Installing nikic/php-parser (v1.3.0) - Installing psy/psysh (v0.4.4) - Installing nesbot/carbon (1.19.) - Installing mtdowling/cron-expression (v1.0.4) - Installing monolog/monolog (1.13.) - Installing league/flysystem (1.0.) - Installing jeremeamia/SuperClosure (2.1.)
- Installing ircmaxell/password-compat (v1.0.4) - Installing doctrine/inflector (v1.0.1) - Installing danielstjules/stringy (1.9.) - Installing symfony/filesystem (v2.7.0) - Installing classpreloader/classpreloader (1.4.) - Installing laravel/framework (v5.0.32) - Installing sebastian/version (1.0.) - Installing sebastian/global-state (1.0.) - Installing sebastian/recursion-context (1.0.) - Installing sebastian/exporter (1.2.) - Installing sebastian/environment (1.2.) - Installing sebastian/diff (1.3.) - Installing sebastian/comparator (1.1.) - Installing symfony/yaml (v2.7.0) - Installing doctrine/instantiator (1.0.) - Installing phpdocumentor/reflection-docblock (2.0.) - Installing phpspec/prophecy (v1.4.1)
- Installing phpunit/php-text-template (1.2.) - Installing phpunit/phpunit-mock-objects (2.3.) - Installing phpunit/php-timer (1.0.) - Installing phpunit/php-token-stream (1.4.) - Installing phpunit/php-file-iterator (1.4.) - Installing phpunit/php-code-coverage (2.1.) - Installing phpunit/phpunit (4.7.) - Installing phpspec/php-diff (v1.0.2) - Installing phpspec/phpspec (2.2.) symfony/var-dumper suggests installing ext-symfony_debug ()
symfony/translation suggests installing symfony/config ()
symfony/security-core suggests installing symfony/validator (For using the user password constraint)
symfony/security-core suggests installing symfony/expression-language (For using the expression voter)
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
symfony/routing suggests installing doctrine/annotations (For using the annotation loader)
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/http-kernel suggests installing symfony/browser-kit ()
symfony/http-kernel suggests installing symfony/class-loader ()
symfony/http-kernel suggests installing symfony/config ()
symfony/http-kernel suggests installing symfony/dependency-injection ()
psy/psysh suggests installing ext-posix (If you have PCNTL, you'll want the POSIX extension as well.)
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing raven/raven (Allow sending log messages to a Sentry server)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing videlalvaro/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
league/flysystem suggests installing predis/predis (Allows you to use Predis for caching)
league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem)
league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files)
league/flysystem suggests installing league/flysystem-copy (Allows you to use Copy.com storage)
league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage)
league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage)
league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2)
league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3)
league/flysystem suggests installing league/flysystem-dropbox (Allows you to use Dropbox storage)
league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching)
league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib)
league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter)
laravel/framework suggests installing aws/aws-sdk-php (Required to use the SQS queue driver and SES mail driver (~2.4).)
laravel/framework suggests installing doctrine/dbal (Required to rename columns and drop SQLite columns (~2.4).)
laravel/framework suggests installing guzzlehttp/guzzle (Required to use the Mailgun and Mandrill mail drivers (~5.0).)
laravel/framework suggests installing iron-io/iron_mq (Required to use the iron queue driver (~1.5).)
laravel/framework suggests installing league/flysystem-aws-s3-v2 (Required to use the Flysystem S3 driver (~1.0).)
laravel/framework suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (~1.0).)
laravel/framework suggests installing pda/pheanstalk (Required to use the beanstalk queue driver (~3.0).)
laravel/framework suggests installing predis/predis (Required to use the redis cache and queue drivers (~1.0).)
sebastian/global-state suggests installing ext-uopz (*)
phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0)
phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
phpspec/phpspec suggests installing phpspec/nyan-formatters (~1.0 – Adds Nyan formatters)

实际上larave/laravel只是一个当你创建一个新项目时你得到的应用框架,比如使用命令:

composer create-project laravel/laravel --prefer-dist

注意: composer create-project命令从功能上来说等于 git clone laravel/laravel和一个composer install命令。

那么composer是如何知道一个package的repo地址的呢?

http://grossi.io/2013/creating-your-first-composer-packagist-package/

laravel/laravel实际上是一个当你创建一个新项目时所需要的应用框架skeleton.她提供一个推荐的默认文件结构(你当然可以不用这个文件结构哦)。这个repo包含默认的config files,controllers,routes等,同时包含用于bootstraping应用的代码。

她也包含一个composer.json文件,这个文件定义了实际的laravel framework作为laravel/laravel的dependency:

"require": {
"laravel/framework": "5.0.*"
},

laravel/framework是实际的framework source。正如framework的repo中的readme.md所说“这个repo包含了laravel fraemworkd的core code(实际上就是一些类库),如果你希望使用laravel 5来构建一个应用,请访问laravel/laravel repo”,也就是说可以理解laravel/framework本身就是一个component,可以被laravel/laravel来使用(提供bootstrap应用,将laravel/framework各个组件组合在一起最终形成一个application),当然也可以在其他的应用中以一个独立的component来使用。

另外一个说法也对理解他们之间的关系有所帮助:

laravel/laravel is the part of the app that you work with yourself(controllers,config,routes.php,resources,database etc)while laravel/framework is the "core" of laravel, stuff that you don't change.

laravel/laravel is the application template/skeleton, and is the starting point for laravel apps. Laravel/framework is the kernel, which contains the actual framework components itself, and is downloaded by composer into your application template/skeleton.

参考以下文章:

http://grossi.io/2013/creating-your-first-composer-packagist-package/

laravel/laravel和laravel/framework有何区别?的更多相关文章

  1. Laravel 5使用Laravel Excel实现Excel/CSV文件导入导出的功能详解

    1.简介 本文主要给大家介绍了关于Laravel 5用Laravel Excel实现Excel/CSV文件导入导出的相关内容,下面话不多说了,来一起看看详细的介绍吧. Laravel Excel 在 ...

  2. Laravel 调试利器 —— Laravel Debugbar 扩展包安装及使用教程

    1.简介 Laravel Debugbar 在 Laravel 5 中集成了 PHP Debug Bar ,用于显示调试及错误信息以方便开发.该扩展包包含了一个 ServiceProvider 用于注 ...

  3. Laravel篇之Laravel的安装及使用

      想搭建一个基于Lavarel和vuejs的个人网站,使用git推送到github存储,千里之行,始于足下,首先要做的用composer来下载laravel框架,并成功运行. 一.使用compose ...

  4. Laravel开发:Laravel框架门面Facade源码分析

    前言 这篇文章我们开始讲 laravel 框架中的门面 Facade,什么是门面呢?官方文档: Facades(读音:/fəˈsäd/ )为应用程序的服务容器中可用的类提供了一个「静态」接口.Lara ...

  5. laravel报错 : laravel Please provide a valid cache path

    这是因为laravel的缓存路径没有找到 laravel缓存文件路径是在 config/cache.php中设置,默认存在storage文件夹中 'file' => [ 'driver' =&g ...

  6. Laravel教程:laravel 4安装及入门

    一.安装Composer首先你需要安装Composer,Composer是PHP依赖管理工具,Laravel框架就是使用 Composer 执行安装和依赖管理. 注:(1)若安装Composer出错, ...

  7. 用Laravel Sms实现 laravel短信验证码的发送

    使用Laravel Sms这个扩展包实现短信验证码的发送,这里以阿里云的短信服务为例: 首先,要创建短信签名和短信模板,具体申请详情如下, 接下来,需要创建AccessKey,由于AccessKey是 ...

  8. laravel记录笔记Laravel 连接数据库、操作数据库的三种方式

    laravel中提供DB facade(原始查找).查询构造器.Eloquent ORM三种操作数据库方式 1.连接数据库 .env 数据库配置 DB_HOST=localhost dbhost DB ...

  9. Laravel开发:Laravel核心——Ioc服务容器源码解析(服务器解析)

    make解析 服务容器对对象的自动解析是服务容器的核心功能,make 函数.build 函数是实例化对象重要的核心,先大致看一下代码: public function make($abstract) ...

随机推荐

  1. Python中__init__方法/__name__系统变量讲解

    __init__方法在类的一个对象被建立时,马上运行.这个方法可以用来对你的对象做一些你希望的初始化. 代码例子 test.py#!/usr/bin/python# Filename: class_i ...

  2. Altium Designer 使用小结

    今天刚把做好的PCB文件交给工厂去制板,阶段工作告一段落,来一个小总结. 前一段时间复习完C语言之后,在中国知网上搜索用单片机实现的小制作,找比较有意思,又不需要太多外专业知识的东西,然后就相中了超声 ...

  3. 2013年优秀jQuery插件

    今天为大家推荐的是2013年的第一期,在这期里面十个jQuery插件涵盖了响应式的网格布局插件.图片放大插件.表单元素中自定义select插件,google 地图插件.文件拖放上传插件.tooltip ...

  4. Sqli-labs less 39

    Less-39 和less-38的区别在于sql语句的不一样:SELECT * FROM users WHERE id=$id LIMIT 0,1 也就是数字型注入,我们可以构造以下的payload: ...

  5. Python中的两种列表

    python中有两种类型的列表:其中一种是用[]创建的列表,这种列表具有伸缩性,可以动态改变,而另外一种列表是用()创建,成为元组,元组一旦创建,在任何状况下都不能再改变,是一种常量列表. movie ...

  6. Java 延时常见的几种方法

    1. 用Thread就不会iu无法终止 new Thread(new Runnable() { public void run() { while (true) { test(); try { Thr ...

  7. HDU4831&&4832&&4834

    好久没打代码啦,今天lu一发百度之星,感觉还是学到不少东西的,写点收获. 第一题就是现在的HDU4831啦,题意很清楚,我一开始以为休息区也可以变为风景区,所以就不敢敲了,后来才得知数据里只会改风景区 ...

  8. POJ 3301 Texas Trip (三分)

    题目链接 题意 : 给你若干个点,让你找最小的正方形覆盖这所有的点.输出面积. 思路 : 三分枚举正方形两对边的距离,然后求出最大,本题用的是旋转正方形,也可以用旋转点,即点的相对位置不变. 正方形从 ...

  9. Android核心分析之十四Android GWES之输入系统

          Android输入系统 依照惯例,在研究Android输入系统之前给出输入系统的本质描述:从哲学的观点来看,输入系统就是解决从哪里来又将到哪里去问题.输入的本质上的工作就是收集用户输入信息 ...

  10. uploadify IO Error/http error 413

    阿里云的服务器 linux 服务器,php 环境,上传附件问题,记录分享一下: 开始测试的时候,都是图片,小附件,没什么问题 系统上线后,发现大的附件上传 有问题,报错 IO Error 开始检查程序 ...