Laminas API Tools - unable to create new API in Admi UI

Anyone else is experiencing an error when creating new API tool when navigating to: [url]/api-tools/ui ?

Currently I am getting:

Fatal error: Uncaught Laminas\ModuleManager\Exception\RuntimeException: Module (ApplicationTest) could not be initialized. in E:\RZECZY_ADAMA\_XAMPP\xampp-7.4\htdocs\laminas_app\vendor\laminas\laminas-modulemanager\src\ModuleManager.php:202

It looks like you added the module ApplicationTest in config/modules.config.php.
You shouldn’t. Can you show use the content of this file => config/modules.config.php

Yes, the Admin UI during creation of new endpoint did add the 'ApplicationTest', into the list as the last item. Is that a bug?

Full list:

return array(
    'Laminas\\Serializer',
    'Laminas\\Paginator',
    'Laminas\\Di',
    'Laminas\\Log',
    'Laminas\\Db',
    'Laminas\\Mvc\\Plugin\\FilePrg',
    'Laminas\\Mvc\\Plugin\\FlashMessenger',
    'Laminas\\Mvc\\Plugin\\Identity',
    'Laminas\\Mvc\\Plugin\\Prg',
    'Laminas\\Session',
    'Laminas\\Mvc\\I18n',
    'Laminas\\Mvc\\Console',
    'Laminas\\Form',
    'Laminas\\Hydrator',
    'Laminas\\InputFilter',
    'Laminas\\Filter',
    'Laminas\\I18n',
    'Laminas\\Cache',
    'Laminas\\Router',
    'Laminas\\Validator',
    'Laminas\\DeveloperTools',
    'Laminas\\ApiTools\\ApiProblem',
    'Laminas\\ApiTools\\ContentNegotiation',
    'Laminas\\ApiTools\\Rpc',
    'Laminas\\ApiTools\\MvcAuth',
    'Laminas\\ApiTools\\Hal',
    'Laminas\\ApiTools\\Rest',
    'Laminas\\ApiTools\\ContentValidation',
    'Laminas\\ApiTools',
    'Laminas\\ApiTools\\Configuration',
    'Laminas\\ApiTools\\Admin',
    'Laminas\\ApiTools\\Documentation',
    'Application',
    
);

ok now can you show us the parts involving autoloading in your composer.json please

@gary it turns out Laminas API Tools Admin UI have a bug as the default module structure have changed. Here is how it should look like:

image

I will raise a ticket on the related repo.

Here is a link: https://github.com/laminas-api-tools/api-tools-admin/issues/52

have you tried to overwrite the value of path_spec to psr-4 in the following config:

    'api-tools-admin' => [
    // path_spec defines whether modules should be created using PSR-0
    //     or PSR-4 module structure; the default is to use PSR-0.
    //     Valid values are:
    //     - Laminas\ApiTools\Admin\Model\ModulePathSpec::PSR_0 ("psr-0")
    //     - Laminas\ApiTools\Admin\Model\ModulePathSpec::PSR_4 ("psr-4")
    // 'path_spec' => 'psr-0',
],

I’ve already found out a solution myself above and marked it as Solution.

Thanks for reply anyway :slight_smile: