dhiraj1site/jsonappend

A simple PHP library package to append JSON entries into a pre-existing JSON file

Installs: 7

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/dhiraj1site/jsonappend

dev-master 2021-06-21 16:25 UTC

This package is not auto-updated.

Last update: 2025-09-28 10:16:26 UTC


README

If you are trying to append a JSON entry into a pre-existing JSON file, you can use this library to add/append additional entries to a JSON file format. This package also supports a separate function to ignore pre-existing JSON entries.

Installation

composer require dhiraj1site/jsonappend

Usage

There are basically two major functions used in the JSONAppend class.

Function #1 - appendJSON

This function requires two parameters. The first parameter will be the source JSON file you need to append into. The second parameter will be an array with key/value pair which you require to append into the source JSON file.

@param1 - .json file @param2 - array $appenditems

Function #2 - appendUniqueJSON

This function is similar to appendJSON. Except this ignores duplicate JSON entires. Parameters are the same as above

use JSONAppend;
JSONAppend::appendUniqueJSON('services.json', array($items));