你能回答我吗?我使用最新版本的Laravel,我想将PayPal服务添加到我的项目中。我想安装一些软件包到Laravel,并将这2行添加到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
加载作曲家存储库,其中包含包装信息更新依赖项(包括require-dev(没有安装或更新生成优化的自动加载文件
照明 Foundation Composerscripts :: postautoloddump /usr/local/bin/php工匠包:发现 该系统找不到指定的路径。 脚本/usr/local/bin/php工匠软件包:发现返回的autoload-dump事件,带有错误代码1
安装所有包裹后
composer dumpautoload
软件包
-
composer require guzzlehttp/guzzle-services
-
composer require paypal/rest-api-sdk-php
-
composer dumpautoload
而不是手动编写composer.json
,尝试使用特定命令安装并添加它们。这样。
composer require paypal/rest-api-sdk-php
composer require guzzlehttp/guzzle
这样,您将避免任何错别字,并且composer.json
文件将尽可能纯净。
尝试此composer require paypal/rest-api-sdk-php
参考:https://packagist.org/packages/paypal/rest-api-sdk-php
编辑:删除作曲家上的PayPal/REST-API-SDK-PHP。
composer require guzzlehttp/guzzle