You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now to load yaml or other filetypes other than the standard formats (ini, php, json) the user would have to make a class that extends the LiteConfig class and make a custom_handler method (as shown in the README).
However, that is a lot of "work" and code to just load yaml files.
The Solution
It could be solved using a single line like this: (first arg $extensions can be string|array)
Make a new method in LiteConfig called custom_file_format() that takes an array|string as first argument, and a callback as second argument. It should just be used in getFileContent().
Remember to make a phpunit tests for this, just with the yaml is fine. You can install the symfony/yaml package with dev flag.
And also update the README.md.
The current "custom_handler" functionality should not be touched, it should still work.
The Problem
Right now to load yaml or other filetypes other than the standard formats (ini, php, json) the user would have to make a class that extends the LiteConfig class and make a
custom_handler
method (as shown in the README).However, that is a lot of "work" and code to just load yaml files.
The Solution
It could be solved using a single line like this: (first arg $extensions can be string|array)
A complete example would look like:
Todo
Make a new method in LiteConfig called custom_file_format() that takes an array|string as first argument, and a callback as second argument. It should just be used in getFileContent().
Remember to make a phpunit tests for this, just with the yaml is fine. You can install the symfony/yaml package with dev flag.
And also update the README.md.
The current "custom_handler" functionality should not be touched, it should still work.
Please ask if you have any questions.
🎃 For more PHP hacktoberfest issues, see:
https://github.com/search?q=owner%3Axy2z+label%3Ahacktoberfest+is%3Aopen&type=issues&s=comments&o=asc
The text was updated successfully, but these errors were encountered: