laminas / laminas-cli

Console command runner, exposing commands written in Laminas MVC and Mezzio components and applications
https://docs.laminas.dev/laminas-cli
BSD 3-Clause "New" or "Revised" License
55 stars 22 forks source link

Allow a config array for the container, instead of a path #83

Open finn-matti opened 2 years ago

finn-matti commented 2 years ago

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

It would be great if the ContainerResolver could accept an array as its configuration instead of a path. This would make it function similarly to the mvc skeleton's index.php:

$appConfig = require __DIR__ . '/../config/application.config.php';
if (file_exists(__DIR__ . '/../config/development.config.php')) {
    $appConfig = ArrayUtils::merge($appConfig, require __DIR__ . '/../config/development.config.php');
}

// Run the application!
Application::init($appConfig)->run();

This is great because it allows you to merge another configuration file into the config.

With laminas-cli this is currently not possible, it seems. Or maybe I just don't know how?

froschdesign commented 2 years ago

@finn-matti Something like this: https://github.com/laminas/laminas-cli/issues/78#issuecomment-856529722 ?

finn-matti commented 2 years ago

I guess that would work. However I still think being able to stick an array in the ContainerResolver would be nicer for folks like me, who have to use laminas-cli through an index.php instead of the provided binary because of requirements I can't change.

froschdesign commented 2 years ago

I guess that would work.

Yes, the workaround from #78 works but it is still a workaround and the feature should be implemented.


The goal of #78 and your feature request is the same, right?

finn-matti commented 2 years ago

The goal of #78 and your feature request is the same, right?

Yes. The end goal is the possibility of optional includes. But: Preferably as an array, that can just be handed over to the ContainerResolver. Since I didn't see anything as regards to the last part of my request (except that the current solution is a workaround, which lets me infer stuff, but I am not yet certain which is why I'm weaseling around here… apologies!): if the last part of my request would be added to that request explicitly, this one could be closed, as far as I am concerned. 👍