2
votes

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

3
put it in the inside requireMiggy
"guzzlehttp/guzzle": "~5.2", that needs to go in the require sectionuser320487
instead of writing it to composer.json manually you can run composer require guzzlehttp/guzzle that way you wont get any composer related errors. You can also define version you want to useAnar Bayramov

3 Answers

2
votes

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.

0
votes

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