在安装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. Nginx负载均衡介绍

    Nginx真心牛逼 nginx不单可以作为强大的web服务器,也可以作为一个反向代理服务器,而且nginx还可以按照调度规则实现动态.静态页面的分离,可以按照轮询.ip哈希.URL哈希.权重等多种方式 ...

  2. Best Practices for Web Apps

    Mobile Web Best Practices Exceptional Performance Let's make the web faster

  3. JS读取client端的文件的代码片段

    JS读取client端的文件内容的代码片段 if(window.FileReader){ var html5file = this.pipeDetailFileUpLoader._files[0]; ...

  4. css内边距与外边距的区别

    你真的了解margin吗?你知道margin有什么特性吗?你知道什么是垂直外边距合并?margin在块元素.内联元素中的区别?什么时候该用 padding而不是margin?你知道负margin吗?你 ...

  5. HDU 4572 Bottles Arrangement(找规律,仔细读题)

    题目 //找规律,123321123321123321…发现这样排列恰好可以错开 // 其中注意题中数据范围: M是行,N是列,3 <= N < 2×M //则猜测:m,m,m-1,m-1 ...

  6. SharePoint Server 2007 简体中文下载

    SharePoint Server 2007 简体中文下载 2010-12-16 10:56 正式版key SN: Tkjcb-3wkhk-2ty2t-qymk2-9xm2y 这个版本也是通过Key来 ...

  7. 无线Ad-hoc网络的关键技术之路由(转)

    无线Ad-hoc网络的关键技术之路由http://network.51cto.com/art/201003/189719.htm

  8. POJ 1279 Art Gallery(半平面交求多边形核的面积)

    题目链接 题意 : 求一个多边形的核的面积. 思路 : 半平面交求多边形的核,然后在求面积即可. #include <stdio.h> #include <string.h> ...

  9. 传说中的WCF(9):流与文件传输

    在使用Socket/TCP来传输文件,弄起来不仅会有些复杂,而且较经典的“粘包”问题有时候会让人火冒七丈.如果你不喜欢用Socket来传文件,不妨试试WCF,WCF的流模式传输还是相当强大和相当实用的 ...

  10. C 和C++ 名称修饰规则

    C名称修饰规则 1.对于使用__cdecl调用约定的函数,在函数名称前加一下划线,不考虑参数和返回值. 2.对于使用__fastcall调用约定的函数,在函数名称前后各加一@符号,后跟参数的长度,不考 ...