在安装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. Notepad++ 几款实用插件简介,让你的 Notepad++ 如虎添翼

    Notepad++ 是一款非常优秀的文本编辑器,非常适合编辑源代码.Notepad++ 安装时已经附带有 Compare 等优秀插件,通过其 Plugin Manager 可以下载更多实用插件. 一. ...

  2. racle 11g impdp时 报ORA-12899

    racle 11g impdp时 报ORA-12899 (2012-07-16 16:42:12) 转载▼ 标签: oracle imp impdp it 分类: oracle技术-开发 源库ZHS1 ...

  3. POJ 2484

    A Funny Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3861   Accepted: 2311 Desc ...

  4. Wamp Mysql错误消息 语言设置

    Wamp Mysql错误消息 语言设置 http://my.oschina.net/wandershi/blog/264347 打开my.ini   找到 [wampmysqld] port = 33 ...

  5. spring 主题使用详解[转]

    在common_include_v2.jsp文件中,spring主题的使用: <link href="${staticPath }/<spring:theme code='sty ...

  6. Django视频教程 - 基于Python的Web框架(全13集)

    Django是由Python驱动的开源模型-视图-控制器(MVC)风格的Web应用程序框架,使用Django可以在即可分钟内快速开发一个高品质易维护数据库驱动的应用程序.下面是一大坨关于Django应 ...

  7. 递推DP HDOJ 5328 Problem Killer

    题目传送门 /* 递推DP: 如果a, b, c是等差数列,且b, c, d是等差数列,那么a, b, c, d是等差数列,等比数列同理 判断ai-2, ai-1, ai是否是等差(比)数列,能在O( ...

  8. HDFS Protocol修改流程

        相对于1.x版本的Hadoop,2.x版本的Hadoop采用了Protocol Buffer作为序列化反序列化工具,以及RPC通讯工具.这样当我们对Hadoop源码进行修改之前,就需要了解Ha ...

  9. C# Socket 入门4 UPD 发送结构体(转)

    今天我们来学 socket  发送结构体 1. 先看要发送的结构体 using System; using System.Collections.Generic; using System.Text; ...

  10. Java7编程高手进阶读书笔记—集合框架

    定义:Java集合框架API是用来表示和操作集合的统一框架,它包含接口.实现类.以及帮助程序员完成一些编程的算法 作用: ●编程更加省力,提高城程序速度和代码质量 ● 非关联的API提高互操作性 ● ...