如何在Laravel中安装Guzzle 6?

时间:2018-04-04 06:47:15

标签: laravel laravel-5

我需要在Laravel 5.6中安装Guzzle 6

我运行此代码:

作曲家需要php-http / guzzle6-adapter

但运行此代码后,显示错误:

./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
  - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)         
  - Installing guzzlehttp/guzzle (6.3.2): Downloading (100%)         
  - Installing php-http/guzzle6-adapter (v1.1.1): Downloading (100%)         

Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
PHP Fatal error:  Uncaught ReflectionException: Class 
App\Console\Kernel does not exist in   
/vendor/laravel/framework/src/Illuminate/Container/Container.php:767
Stack trace:
#0 
/vendor/laravel/framework/src/Illuminate/Container/Container.php(767): 
ReflectionClass->__construct('App\\Console\\Ker...')
#1  
/vendor/laravel/framework/src/Illuminate/Container/Container.php(646): 
Illuminate\Container\Container->build('App\\Console\\Ker...')
#2         
vendor/laravel/framework/src/Illuminate/Container/Container.php(601):             
Illuminate\Container\Container->resolve('App\\Console\\Ker...', Array)
#3 /ven 
dor/laravel/framework/src/Illuminate/Foundation/Application.php(740): 
Illuminate\Container\Container->make('App\\Console\\Ker...', Array)
#4 
/vendor/laravel/framework/src/Illuminate/Container/Container.php(256):     
Illuminate\Foundation\Appl in 
/vendor/laravel/framework/src/Illuminate/Container/Container.php on 
line 767
Script @php artisan package:discover handling the post-autoload-dump 
event returned with error code 255

我想在laravel 5.6中安装mailgun pakage。

更新1:

My Composer.json文件是这段代码:

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
    "php": ">=7.1.3",
    "bogardo/mailgun": "^5.0",
    "cviebrock/eloquent-sluggable": "^4.5",
    "fideloper/proxy": "~4.0",
    "intervention/image": "^2.4",
    "laravel/framework": "5.6.*",
    "laravel/tinker": "~1.0",
    "laravelcollective/html": "^5.6",
    "php-http/guzzle6-adapter": "^1.1",
    "pusher/pusher-php-server": "^3.0",
    "uxweb/sweet-alert": "^1.4"
},
"require-dev": {
    "filp/whoops": "~2.0",
    "nunomaduro/collision": "~1.1",
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "~1.0",
    "phpunit/phpunit": "~7.0",
    "symfony/thanks": "^1.0"
},
"aXutoload": {
    "classmap": [
        "database/seeds",
        "database/factories"
    ],
    "psr-4": {
        "App\\": "app/"
    }
},
"autoload-dev": {
    "psr-4": {
        "Tests\\": "tests/"
    }
},
"extra": {
    "laravel": {
        "dont-discover": [
        ]
    }
},
"scripts": {
    "post-root-package-install": [
        "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "@php artisan key:generate"
    ],
    "post-autoload-dump": [
        "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
        "@php artisan package:discover"
    ]
},
"config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}

我需要在Laravel 5.6中安装Guzzle 6。

我使用这个包:https://packalyst.com/packages/package/bogardo/mailgun

如何发出此问题?

2 个答案:

答案 0 :(得分:1)

您必须删除"aXutoload": !!!!!!

中的X.

答案 1 :(得分:0)

这通常通过以下方式解决:

php artisan config:clear
php artisan cache:clear
composer dump-autoload