Read and write PHP array| Laravel Collection | EloquentCollection to json file
You can install the package via composer:
composer require manojkiran/jsonwriter
use Manojkiran\JsonWriter\Facades\JsonWriter;
//get the List of Active users
$usersList = User::where('status','=','Active')->get();
//getting the path where the file is available
$jsonFilePath = storage_path('jsonWriter.json');
//loading the Json File and Writing the Content to it
$writeToJson = JsonWriter::load( $jsonFilePath)
->write($usersList);
//by default the duplicate Content Will Not to Writtent To Json File(To Reduce the data Size)
//array of the Projects by Taylor Otwell
$laravel = ['name' => 'Taylor Otwell','developed' => ['Laravel','Lumen','Telescope','Nova']];
//getting the path where the file is available
$jsonFilePath = storage_path('jsonWriter.json');
//loading the Json File and Writing the Content to it
$writeToJson = JsonWriter::load( $jsonFilePath)
->write($laravel,true);
//get the List of Active users
$usersList = User::where('status','=','Active')->get();
//getting the path where the file is available
$jsonFilePath = storage_path('jsonWriter.json');
//loading the Json File and Writing the Content to it
$writeToJson = JsonWriter::load( $jsonFilePath)
->parseFile();
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email manojkiran10031998@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.