A
A
asdasdqwe2021-12-20 14:03:45
Composer
asdasdqwe, 2021-12-20 14:03:45

How does autoload work in laravel?

"autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },

I study composer.
What confuses me is that the databse path is duplicated in laravel composer.json. That is, developers could simply write like this:
"autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\": "database/",
        }
    },


And in the end, all seeders and factories will be found in the database folder. Why is there duplication?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leonid, 2021-12-20
@asdasdqwe

there may be folders that do not need to be autoloaded

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question