Elias Tutungi
Elias Tutungi

Reputation: 340

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: enter image description here

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:

enter image description here

I use PhpStorm and he recognizes the namespace enter image description here

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

Upvotes: 2

Views: 40439

Answers (2)

Joan Nguyen
Joan Nguyen

Reputation: 372

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.

Upvotes: 6

Gautam Patadiya
Gautam Patadiya

Reputation: 1412

You can use this commands may can help you:

composer dump-autoload -o

Good Luck

Upvotes: 0

Related Questions