在安装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. 百度之星A

    Scenic Popularity Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  2. 浏览器解析HTML文档的资源并下载

    <img />,<style>这些资源是并行请求与加载. <script>脚本是同步请求与加载,阻塞加载.加载完成并执行后再继续解析HTML. 动态<scri ...

  3. ASP.NET中读取excel内容并显示

    项目中经常会用到把excel的文件内容导入到数据库中的,刚刚花了点时间,做了个例子,基本上能实现导入Excel后显示的功能吧,导入的excel文件得是xls,即是2003的.     代码思路如下:要 ...

  4. display:inline-block 在IE6中实现{转}

    IE6/IE7下对display:inline-block的支持性不好. 1.inline元素的display属性设置为inline-block时,所有的浏览器都支持: 2.block元素的displ ...

  5. css两个form不换行,两个div并排代码

    1.form不换行通过table布局实现 <table> <tr> <td> <form method="get" action=&quo ...

  6. Cpp多重继承会产生的问题

    多重继承常常被认为是 OOP 中一种复杂且不必要的部分.多重继承面临 crash 的场景并非难以想象,来看下面的例子. 1. 名称冲突 来看以下情况: 如果 Dog 类以及 Bird 类都有一个名为 ...

  7. DAL层与BLL层的设计原则

    通用DAL层: 提供一个通用的DAL层的基础框架,其中包括所有实体类的基类,所有DAL类的基类,以及用来在实体类和数据表以及实体类字段和数据表字段之间Mapping的Attributes.此层作为核心 ...

  8. C/C++ 位域知识小结

    C/C++ 位域知识小结 几篇较全面的位域相关的文章: http://www.uplook.cn/blog/9/93362/ C/C++位域(Bit-fields)之我见 C中的位域与大小端问题 内存 ...

  9. Eclipse调试Java的十个技巧

      先提三点 不要使用System.out.println()作为调试工具 启用所有组件的详细的日志记录级别 使用一个日志分析器来阅读日志   1.条件断点 想象一下我们平时如何添加断点,通常的做法是 ...

  10. Linux进程间通信(IPC)

    序言 linux下的进程通信手段基本上是从Unix平台上的进程通信手段继承而来的. 而对Unix发展做出重大贡献的两大主力AT&T的贝尔实验室及BSD(加州大学伯克利分校的伯克利软件发布中心) ...