php 如何运行 composer.json?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22125283/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 04:40:52  来源:igfitidea点击:

How to run composer.json?

phpcomposer-php

提问by user3350814

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "laravel/framework": "4.1.*"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "stable"
}

I'am executing this in my windows console:

我在 Windows 控制台中执行此操作:

php composer.json create-project test2

I just get the above string and nothing happens? how to properly run the composer.json to create a project?

我只是得到上面的字符串,什么也没发生?如何正确运行 composer.json 来创建项目?

回答by krynio

You must download composer:

您必须下载作曲家:

curl -sS https://getcomposer.org/installer | php

or

或者

php -r "readfile('https://getcomposer.org/installer');" | php

and next you should run if you have composer.json file:

如果你有 composer.json 文件,接下来你应该运行:

composer.phar install

or if you want create new project

或者如果你想创建新项目

composer.phar create-project

回答by Aminah Nuraini

use composer updatein the same folder that has composer.json, when the composer command (eg. test with composer --version) already exists in your terminal.

当您的终端中已存在composer 命令(例如 test with )时,请composer update在具有 的同一文件夹中使用。composer.jsoncomposer --version

回答by Abdo-Host

i used 'composer install' and it's working good

我使用了“作曲家安装”并且运行良好

composer install

or

或者

php composer install