Open kaloyan-raev opened 7 years ago
@kaloyan-raev we managed the module autoloading using the Zend\Autoloader
in Module.php. Basically, when you create a new API (module), Apigility builds a Module.php file containing the following code:
public function getAutoloaderConfig()
{
return [
'ZF\Apigility\Autoloader' => [
'namespaces' => [
__NAMESPACE__ => __DIR__ . '/src',
],
],
];
}
This function is consumed by the zend-loader to load load the Module/API files. We didn't use the composer.json
autoloading because this will require a composer execution to update the vendor/autoload.php
file.
OK. I see...
We didn't use the composer.json autoloading because this will require a composer execution to update the vendor/autoload.php file.
Is this that bad?
My point is that having the Zend modules explicitly declared in the autoload
section of composer.json would help build better IDE tooling.
@kaloyan-raev you can use https://github.com/zfcampus/zf-composer-autoloading, it is standalone tool to enable module's composer autoloading
This repository has been closed and moved to laminas-api-tools/api-tools-admin; a new issue has been opened at https://github.com/laminas-api-tools/api-tools-admin/issues/13.
Currently we have the following
autoload
section in the composer.json of the Apigility Skeleton Application:Creating a new API module (e.g. "Test") in the Admin UI creates a new ZF module, but the composer.json is not updated with its source folder. I would expect the
autoload
section to be updated like this:Respectively, deleting an API module should update the
autoload/psr-4
section too.