PHP&作曲家,如何合并composer.json文件 [英] PHP & Composer, how do I combine composer.json files

查看:69
本文介绍了PHP&作曲家,如何合并composer.json文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释我应该如何在php中使用composer。我在文档根目录中有一个composer.json文件,该文件会下载项目的核心软件包,但是当我想添加另一个项目(例如google + php sdk)时,请在此处找到 https://github.com/googleplus/gplus-quickstart-php/

Can someone explain how I'm supposed to use composer with a php. I have a composer.json file in my doc root that downloads the core packages for my project, but then when I want to add another project like google+ php sdk found here https://github.com/googleplus/gplus-quickstart-php/

怎么办我用那个composer.json文件吗?我要手动组合它们吗?我是否只是将composer.json下载到其他目录中?

what do I do with that composer.json file? do i combine them manually? Do I just download that composer.json into a different dir?

我当前的composer.json文件看起来像这样

my current composer.json file looks like this

 {
"name": "fuel/fuel",
"type": "metapackage",
"description": "The FuelPHP framework",
"keywords": ["framework"],
"homepage": "http://fuelphp.com",
"license": "MIT",
"authors": [
    {
        "name": "FuelPHP Development Team",
        "email": "team@fuelphp.com"
    }
],
"support": {
    "irc": "irc://irc.freenode.org/fuelphp",
    "forum": "http://fuelphp.com/forums"
},
"require": {
    "php": ">=5.3.3",
    "monolog/monolog": "1.5.*",
    "fuelphp/upload": "2.0",
    "omissis/php-cloudfiles": "dev-master",
    "mustache/mustache": "*"
},
"suggest": {
    "mustache/mustache": "Allow Mustache templating with the Parser package",
    "smarty/smarty": "Allow Smarty templating with the Parser package",
    "twig/twig": "Allow Twig templating with the Parser package",
    "mthaml/mthaml": "Allow Haml templating with Twig supports with the Parser package"
},
"config": {
    "vendor-dir": "fuel/vendor"
},
"minimum-stability": "dev"
}

g + composer.json文件看起来像

The g+ composer.json file looks like

 {
"name": "googleplus/quickstart",
"description": "This quick-start app is built in PHP and lets you get started with the Google+ platform in a few minutes.",
"license": "Apache-2.0",
"repositories": [
    {
        "type": "package",
        "package": {
            "name": "google/google-api-php-client",
            "version": "0.6.2",
            "dist": {
                "url": "http://google-api-php-client.googlecode.com/files/google-api-php-client-0.6.2.tar.gz",
                "type": "tar"
            },
            "autoload": {
                "classmap": [
                    "src/"
                ]
            }
        }
    }
],
"require": {
    "silex/silex": "1.0.*@dev",
    "twig/twig": ">=1.8,<2.0-dev",
    "google/google-api-php-client": "0.6.2"
}
}


推荐答案

只需将其添加到原始作曲家文件的require块中即可:

Simply add this into the require block of your original composer file:

"googleplus/quickstart": "*",

这篇关于PHP&amp;作曲家,如何合并composer.json文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆