Skip to content

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

@butschster

Description

@butschster

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions