在安装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. JavaScript之表单验证讲解

    JavaScript 可用来在数据被送往服务器前对 HTML 表单中的这些输入数据进行验证. JavaScript 表单验证 JavaScript 可用来在数据被送往服务器前对 HTML 表单中的这些 ...

  2. hdu 1171

    求能装入大小为sum/2的背包的最大价值 #include <cstdio> #include <cstdlib> #include <cmath> #includ ...

  3. POJ 1065 Wooden Sticks

    Wooden Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 16262 Accepted: 6748 Descri ...

  4. 100个经典的C算法

    1.题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔 子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数 为多少? #include<stdio.h&g ...

  5. tomcat 跨域

    http://www.360doc.com/content/14/0920/14/7909375_411017244.shtml http://www.tuicool.com/articles/Znq ...

  6. web工程导入MyEclipse 就变成Java工程 ———— 解决方案

    Web 工程 导入到 MyEclipse 中后就变成 Java工程了 折腾大大半天,最后才发现是 .settings 里面文件的配置问题.. .settings 文件夹里面的 org.eclipse. ...

  7. Gradle Goodness: Continue Build Even with Failed Tasks

    If we run a Gradle build and one of the tasks fails, the whole build stops immediately. So we have f ...

  8. [RM HA 2] Hadoop 2.0 ResourceManager HA原理

    继上篇文章验证Cloudera RM HA功能后,现在开始分析Cloudera RM HA的原理. 设计目标 主要目的是为了解决两种问题 计划外的机器挂掉 计划内的如软件和硬件升级等. 架构 流程:两 ...

  9. Zabbix监控解决方案

    思通运维监控主要用来监控IT 基础设施组件的可用性和性能.监控项目是不受限制的,并且可以对IT 基础设施健康状态进行复杂分析.通过确定IT 系统问题的“来源”,使用户快速响应故障来降低宕机成本. 网络 ...

  10. JTAG ARM-OB 被识别为盗版修复的方法

    今天下了一个 Keil 的最新版 V4.70,打开工程,弹出个升级Jlink固件的对话框,也没仔细看,直接点了yes .这下爽了,升级之后弹出个对话框说我的Jlink是盗版的,然后工程自动关闭,很是无 ...