Laravel更新/安装composer包

时间:2018-02-09 00:55:44

标签: php laravel paypal composer-php

你能回答我吗? 我使用最新版本的Laravel,我想在我的项目中添加PayPal服务。 我想将一些软件包安装到Laravel并将这两行添加到composer.json

"guzzlehttp/guzzle": "~5.2",

"paypal/rest-api-sdk-php": "*"

我的composer.json文件

   {
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=7.0.0",
        "fideloper/proxy": "~3.3",
        "laravel/framework": "5.5.*",
        "laravel/tinker": "~1.0"
    },
    "require-dev": {
        "filp/whoops": "~2.0",
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~6.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "/usr/local/bin/php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "/usr/local/bin/php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "/usr/local/bin/php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true,
    "cache-dir": "/home/iamdevco/public_html/norrisms/designer/cache"
    },
    "guzzlehttp/guzzle": "~5.2",

"paypal/rest-api-sdk-php": "*"
}

但是我在下载软件包后出现此错误

$ composer update

使用包信息加载composer存储库 更新依赖项(包括require-dev) 无需安装或更新 生成优化的自动加载文件

  

照亮\基金会\ ComposerScripts :: postAutoloadDump   / usr / local / bin / php artisan package:discover   该系统找不到指定的路径。   脚本/ usr / local / bin / php artisan包:发现处理返回的自动加载转储事件,错误代码为1

3 个答案:

答案 0 :(得分:2)

答案 1 :(得分:1)

不是手动编写composer.json,而是尝试使用特定命令安装和添加它们。像这样。

composer require paypal/rest-api-sdk-php

composer require guzzlehttp/guzzle

这样,您就可以避免任何拼写错误,composer.json文件将尽可能保持纯正。

答案 2 :(得分:0)

试试这个composer require paypal/rest-api-sdk-php

参考:https://packagist.org/packages/paypal/rest-api-sdk-php

编辑: 删除composer.json上的paypal / rest-api-sdk-php然后尝试这个

composer require guzzlehttp/guzzle