Laravel Update / install composer package
Solution 1
after you install all packages run
composer dumpautoload
packages
composer require guzzlehttp/guzzle-services
composer require paypal/rest-api-sdk-php
composer dumpautoload
Solution 2
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.
Comments
-
Nasser Ali Karimi over 1 year
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
-
Miggy almost 6 yearsput it in the inside require
-
Admin almost 6 years"guzzlehttp/guzzle": "~5.2", that needs to go in the require section
-
Anar Bayramov almost 6 yearsinstead 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 use
-
-
Nasser Ali Karimi almost 6 yearsThanks for this. but when I run composer dump-autoload this error still issue.