简体   繁体   中英

vendor class not found in laravel

I use unisharp file manager in my project. on my local machine everything works fine, but on remote server it throws error [Symfony\\Component\\Debug\\Exception\\FatalErrorException] Class 'Unisharp\\Laravelfilemanager\\LaravelFilemanagerServiceProvider' not found in config/app.php everything's correct

    /*FileMananger*/
    Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
    Intervention\Image\ImageServiceProvider::class,
    /*CKEditor*/
    Unisharp\Ckeditor\ServiceProvider::class,

there is directory unisharp in vedor(so all files and directories are there). when i try to run composer install/update i get this error again. so everything in its right place, but laravel doesn't see this class.

comoser.json

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
    "php": ">=5.6.4",
    "laravel/framework": "5.3.*",
    "maatwebsite/excel": "~2.1.0",
    "appzcoder/crud-generator": "^1.2",
    "laravelcollective/html": "^5.3",
    "lavary/laravel-menu": "dev-master",
    "nesbot/carbon": "^1.21",
    "laracasts/flash": "^2.0",
    "spatie/laravel-medialibrary": "^3.11",
    "firebase/php-jwt": "^4.0",
    "doctrine/dbal": "^2.5"
},
"require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~5.0",
    "symfony/css-selector": "3.1.*",
    "symfony/dom-crawler": "3.1.*"
},
"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    },
    "files": [
        "app/Http/helpers.php"
    ]
},
"autoload-dev": {
    "classmap": [
        "tests/TestCase.php"
    ]
},
"scripts": {
    "post-root-package-install": [
        "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ],
    "post-install-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postInstall",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postUpdate",
        "php artisan optimize"
    ]
},
"config": {
    "preferred-install": "dist"
}
}

Try to comment those lines in config/app.php and run composer require unisharp/laravel-filemanager again.

You can't set up service providers before they are downloaded through composer.

你需要运行:

composer require unisharp/laravel-filemanager

Make sure your config/app.php unisharp providers is matched with the content in folder vendor unisharp composer.json check below:

Config/app.php 在此处输入图片说明

vendor/unisharp-composer.json 在此处输入图片说明

the solution is very easy :) just make sure you have this in your service provider:

 Unisharp\\Laravelfilemanager\\LaravelFilemanagerServiceProvider::class,

not this one:

 UniSharp\\Laravelfilemanager\\LaravelFilemanagerServiceProvider::class,

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