Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spiral/config] Use config builder in addition to simple arrays #885

Open
butschster opened this issue Feb 19, 2023 · 1 comment
Open

[spiral/config] Use config builder in addition to simple arrays #885

butschster opened this issue Feb 19, 2023 · 1 comment

Comments

@butschster
Copy link
Member

I have a suggestion for an improvement to the way application configuration is currently handled. While it's possible to configure an application via arrays in config files, it can be difficult to keep track of all available configuration options and their corresponding values.

return [
    'access_token' => env('GITHUB_ACCESS_TOKEN'),
    // ...
];

To address this issue, I propose that the framework automatically generates builders for each config object. This would allow developers to use a more convenient syntax, such as:

return new GithubConfigBuilder()
 ->withAccessToken(env('GITHUB_ACCESS_TOKEN')

By providing this feature, it would greatly simplify the process of configuring an application and reduce the potential for human error. I believe this would be a valuable addition to the Spiral Framework, and I would be happy to discuss the details further.

@roxblnfk
Copy link
Member

I prefer to use a config dto instead of a bilder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants