M
M
mrdragon90002018-11-03 19:54:19
Composer
mrdragon9000, 2018-11-03 19:54:19

How to autoload composer to load functions?

Began to deal with autoloading through composer;
There is a Help folder at the root, where there are both files with classes (a class for working with storage, in the form of a folder with json files), and files with simple functions (for example, config ('filename.variable'), I see no reason to start a class for it) . The question was how to automatically load all this through composer autoload?
In composer.json indicated

"autoload": {
    	"classmap": [
    		"Help/"
    	]
    }

In the classes inside Help, I specified the namespace Help => They are normally loaded and called. But files with functions inside Help are not loaded (undefined). I tried to specify namespace Help in them, but it did not lead to anything.
Tell me how to load them, or an option to change the architecture?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Malazar, 2018-11-03
@Malazar

An example of how everything is connected

{
  "autoload": {
    "psr-4": {
      "ishop\\": "vendor/ishop/core",
      "app\\": "app"
    }
  },

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question