Composer autoloading inside apigility

When we created “New API” (for example, “Status”) via admin panel of apigility it is created new module inside “module” directory of our project. There is “public function getAutoloaderConfig()…” inside new module “Status” inside Module.php.

Is this good in 2019?

How can I put together apigility and PSR-4?

I am trying to figured out how apigility works and and what it does when we do something via admin panel.

If you didn’t has the psr-4 config for “Status” module in composer.json, you can update your module class with remove the getAutoloaderConfig() method, then update composer.json under autoload -> psr4

    "autoload": {
        "psr-4": {
            "Falk\\": "module/Falk/src"
        }
    },

then run composer update

1 Like

It seems this is just the only way to put together apigility and psr-4. And psr-4 can’t be managed from the admin panel.

PSR-4 describes autoloading classes from file paths. Which autoloader should be used or where the configuration comes from is not a part of the specification.
Composer is one option, another can be the getAutoloaderConfig method in the module class.

1 Like