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

Load from string? #51

Closed
VinceG opened this issue Oct 15, 2015 · 4 comments · Fixed by #111
Closed

Load from string? #51

VinceG opened this issue Oct 15, 2015 · 4 comments · Fixed by #111
Milestone

Comments

@VinceG
Copy link

VinceG commented Oct 15, 2015

Was this discussed before? i couldn't find an issue about it.

Loading an XML from string will be beneficial since sometimes we don't have a file saved on the file system to load.

@DavidePastore
Copy link
Collaborator

I agree with you, it could be a nice feature. What do you think @hassankhan?

@hassankhan
Copy link
Owner

If I'm not mistaken, you could subclass AbstractConfig, and then parse the XML into an array yourself and pass it into the constructor method. We could support it - just not sure a lot of people need the functionality 😄

@fengkaijia
Copy link

There's indeed needs. E.g. when the config file has configurations for plugins, and we only want to pass part of the config to the plugin for isolation. So that would be like:

$config = new Config('config.yaml');
$plugin = new $plugin_name(new Config($config->plugin->plugin_name));

This is indeed just a class extends AbstractConfig without anything, but having it at config package is better than creating it at our own package.

@filips123
Copy link
Collaborator

I've created pull request #111 for loading from string.

@DavidePastore DavidePastore added this to the Future Release milestone Jul 28, 2018
@DavidePastore DavidePastore modified the milestones: Future Release, 2.0.0 Oct 6, 2018
peter279k pushed a commit to open-source-contributions/config that referenced this issue May 8, 2021
…it/phpunit-8.2.1

Bump phpunit/phpunit from 8.2.0 to 8.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants