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

File::json() method to get json decoded data from a file. #46481

Merged
merged 2 commits into from
Mar 16, 2023
Merged

File::json() method to get json decoded data from a file. #46481

merged 2 commits into from
Mar 16, 2023

Conversation

AustinW
Copy link
Contributor

@AustinW AustinW commented Mar 15, 2023

This adds a convenient File::json() method to retrieve json encoded data from a file.

Example of current flow:

$contents = File::get('sample.json');
$data = json_decode($contents, true);

New flow using File::json:

$data = File::json('sample.json');

This additional method will not affect current users and eases the development flow when accessing json files. Tests are included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants