B
B
BonBon Slick2017-07-12 13:02:45
Composer
BonBon Slick, 2017-07-12 13:02:45

Laravel autoload third party files?

Laravel 4.2
composer.json

"autoload": {
    "classmap": [
      "app/controllers",
...
      "app/helpers",
      "app/libs"
    ],
    "files": [
      "app/libs/simple_html_dom.php"
    ],
    "psr-0": {
      "app": "app/libs"
    }
  },

In the Controller, I check if the third-party library has loaded:
dd(get_included_files());
It is not in the array, the functions that are used later in this file cause an error.
Constantly including a file via include() or require_once() is dirty, as well as creating an additional function that includes. When there is a solution out of the box, which for some reason does not work. Why doesn't it connect?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
D3lphi, 2017-07-12
@BonBonSlick

In the console, run:
To have composer update its service files. How do you think he will know that there has been a change in composer.json?
And something is not entirely clear to me, why is the question called "Laravel autoload"? The files are connected not by laravel, but by composer.

K
Kirill Nesmeyanov, 2017-07-12
@SerafimArts

What errors does dump-autoload give?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question