简体   繁体   中英

Composer Autoload Laravel 5.5

I started a laravel project in version 5.5, I have been working with version 5.1.

In this version I use the folder 'nob' and I use it to develop some classes to turn them into components.

I used the following composer.json in the version 5.1:

"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/",
        "Nob\\": "nob/"
    }
},

And this is the version 5.5:

"autoload": {
    "classmap": [
        "database/seeds",
        "database/factories"
    ],
    "psr-4": {
        "App\\": "app/",
        "Nob\\": "nob/"
    }
},

I get this error: 在此输入图像描述

This is the class, her namespace is correct

<?php namespace Nob\Payeezy\Types;

use Nob\Payeezy\Payeezy;

class Authorization extends Payeezy
{

And this is the tree:

在此输入图像描述

I use PhpStorm and he recognizes the namespace 在此输入图像描述

I do not know what may be happening, I used composer dump-autoload and nothing.

Your code is correct when I tried on my PhpStorm. But you can run the following three commands:

$ php artisan clear-compiled 
$ composer dump-autoload
$ php artisan optimize

And this will clear the current compiled files, update the classes it needs and then write them back out so you don't have to do it again.

You can use this commands may can help you:

composer dump-autoload -o

Good Luck

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