简体   繁体   中英

Laravel Update / install composer package

Can you answer me? I use the latest version of Laravel and I want to add to my project the PayPal service. I want to install some package to Laravel and added this 2 rows to composer.json

"guzzlehttp/guzzle": "~5.2",

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

My composer.json file

   {
    "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": "*"
}

but I get this error after download packages

$ composer update

Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Generating optimized autoload files

Illuminate\\Foundation\\ComposerScripts::postAutoloadDump /usr/local/bin/php artisan package:discover The system cannot find the path specified. Script /usr/local/bin/php artisan package:discover handling the post-autoload-dump event returned with error code 1

after you install all packages run

composer dumpautoload

packages

  1. composer require guzzlehttp/guzzle-services
  2. composer require paypal/rest-api-sdk-php
  3. composer dumpautoload

Rather than manually writing the composer.json , try installing and adding them with the specific commands. Like this.

composer require paypal/rest-api-sdk-php

composer require guzzlehttp/guzzle

That way, you'll avoid any typos and composer.json file will be kept as pure as possible.

Try this composer require paypal/rest-api-sdk-php

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

Edit: remove the paypal/rest-api-sdk-php on the composer.json and the guzzle then try this

composer require guzzlehttp/guzzle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM