A
A
Alex_ART2017-09-10 15:31:26
PHP
Alex_ART, 2017-09-10 15:31:26

Autoload classes via Composer on hosting?

Good afternoon, I recently started studying composer, after googling a little I implemented class autoloading for my project, it works locally, but Fatal error: Class not found
falls out on the hosting I don’t quite understand how it works at all, and whether it should work, whether something change or some other reason?
7ffd1f501e3c48b092bc3ecc32de999b.jpg
.json

{
  "name": "artberg",
  "require": {},

  "autoload": {
    "psr-4": {
      "App\\": "app/"
    }
  }
}

index.php
require(__DIR__ . '/vendor/autoload.php');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maksim Fedorov, 2017-09-10
@Maksclub

Composer's instructions say this:

After adding the autoload field, you have to re-run dump-autoloadto re-generate the vendor/autoload.php file.
https://getcomposer.org/doc/01-basic-usage.md#auto...
Bottom line:
That is, you need to run the commandcomposer dump-autoload

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question