mezzio / mezzio-skeleton

Laminas mezzio skeleton. Begin developing PSR-15 middleware applications in seconds!
https://docs.mezzio.dev/mezzio/
BSD 3-Clause "New" or "Revised" License
120 stars 31 forks source link

Add the ability to specify configuration options #124

Open settermjd opened 1 year ago

settermjd commented 1 year ago

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

Here is a summary of the issue.

froschdesign commented 1 year ago

@settermjd Can you be a little more specific about the solution you have in mind?

Xerkus commented 1 year ago

This would be good for testing skeleton too.

Xerkus commented 1 year ago

@settermjd please provide short summary in case we decide to move off discourse later

settermjd commented 1 year ago

Thanks for joining in the discussion, @Xerkus & @froschdesign. Here are some more specifics of what I'm thinking. Mezzio Skeleton asks the following questions:

What I'd like to see is a configuration/command-line option for each of these questions with suitable values able to be provided. Here's a theoretical example of options:

Question Short Option Long Option Allowed Values Default Value
What type of installation would you like? -i --installation minimal, flat, modular flat
Which container do you want to use for dependency injection? -c --container pimple, laminas-servicemanager, symfony-di, php-di, chubbyphp laminas-servicemanager
Which router do you want to use? -r --router fastroute, laminas-router fastroute
Which template engine do you want to use? -t --template-engine plates, twig, laminas-view, none none
Which error handler do you want to use during development? -e --error-handler whoops, none whoops
Xerkus commented 1 year ago

AFAIK the biggest obstacle is that we can not add extra flags for composer create-project. Skeleton installer is a composer plugin. We have 2 options: interactively ask user or non-interactive fallback to no input whatsoever.

This would need a new skeleton installer setup that would not run installer in non-interactive mode and would require another command instead in order to complete setup:

$ composer create-project --no-interaction mezzio/mezzio-skeleton new-app
$ cd new-app
$ composer mezzio-install --container ...

Composer nowadays allows to specify symfony console command class as a script so I expect it to show available options with composer mezzio-install --help which is a plus. I am not calling for the use of laminas-cli here because there is no container yet if installer was skipped.

settermjd commented 1 year ago

AFAIK the biggest obstacle is that we can not add extra flags for composer create-project. Skeleton installer is a composer plugin. We have 2 options: interactively ask user or non-interactive fallback to no input whatsoever.

This would need a new skeleton installer setup that would not run installer in non-interactive mode and would require another command instead in order to complete setup:

$ composer create-project --no-interaction mezzio/mezzio-skeleton new-app
$ cd new-app
$ composer mezzio-install --container ...

Composer nowadays allows to specify symfony console command class as a script so I expect it to show available options with composer mezzio-install --help which is a plus. I am not calling for the use of laminas-cli here because there is no container yet if installer was skipped.

Thanks for the feedback. I'm going to do some research into this and come back to you.