zend-expressive-tooling
zend-expressive-tooling copied to clipboard
[Feature Request] Add new option to module:create: --namespace=NAMESPACE
Would be nice to have this feature to work with arbitrary namespacing for more complex projects.
Something like
composer expressive module:create --namespace=Vendor\Project ModuleName
Resulting with a module in the default src folder with a folder name ModuleName and a namespace Vendor\Project\ModuleName and a ConfigProvider like the following:
<?php
declare(strict_types=1);
namespace Vendor\Project\ModuleName;
/**
* The configuration provider for the ModuleName module
*
* @see https://docs.zendframework.com/zend-component-installer/
*/
class ConfigProvider
{
/**
* Returns the configuration array
*
* To add a bit of a structure, each section is defined in a separate
* method which returns an array with its configuration.
*/
public function __invoke() : array
{
return [
'dependencies' => $this->getDependencies(),
'templates' => $this->getTemplates(),
];
}
/**
* Returns the container dependencies
*/
public function getDependencies() : array
{
return [
'invokables' => [
],
'factories' => [
],
];
}
/**
* Returns the templates configuration
*/
public function getTemplates() : array
{
return [
'paths' => [
'modulename' => [__DIR__ . '/../templates/'],
],
];
}
}
Removed -n from title because it is already used for --no-interaction
It will requires also changes in zf-composer-autoloading, because create command also register the module in composer and to do that correctly we need to know the namespace of the module.
This repository has been closed and moved to mezzio/mezzio-tooling; a new issue has been opened at https://github.com/mezzio/mezzio-tooling/issues/1.