Laravel 10.4 version has been released today and there is a nice feature with it and that is File::json() method. Austin White contributed these features. Now using this method helper, we do not need to fetch json files first. We can easily read JSON files using File::json() method from Laravel 10.4 version.


Here we directly can access the data like below:

// Before
$contents = File::get('product.json');
$data = json_decode($contents, true);
// After
$data = File::json('product.json');


Read also: Laravel 10 New Feature - Laravel Pennant Overview


Hope this tricks of course help you,