Search by

adachsoft / site-settings-json

Arkadiusz Adach

JSON file repository adapters for the AdachSoft Site Settings package.

Package info

gitlab.com/a.adach/site-settings-json

Issues

pkg:composer/adachsoft/site-settings-json

Statistics

Installs: 12

Dependents: 1

Suggesters: 0

Stars: 0

v0.1.0 2026-11-22 09:03 UTC

This package is auto-updated.

Last update: 2026-11-22 08:04:16 UTC


README

A framework-independent JSON file storage adapter for the adachsoft/site-settings package. It provides persistent implementations of the settings and change-log repository interfaces.

Features

  • Stores settings in a versioned JSON document and audit entries in JSON Lines format.
  • Persists encrypted secret records as ciphertext and metadata; encryption remains the responsibility of the core package.
  • Uses file locks and atomic replacement for safe concurrent updates.
  • Creates missing parent directories and secures data and lock files with owner-only permissions.
  • Reports malformed or unsupported data without exposing file contents in exception messages.

Requirements

  • PHP 8.3 or later
  • The JSON extension (ext-json)

Installation

composer require adachsoft/site-settings-json

Basic usage

use AdachSoft\SiteSettingsJson\Repository\JsonFileSettingChangeLogRepository;
use AdachSoft\SiteSettingsJson\Repository\JsonFileSettingRepository;

$settings = new JsonFileSettingRepository('/var/lib/my-site/settings.json');
$changeLog = new JsonFileSettingChangeLogRepository('/var/lib/my-site/settings.jsonl');

$settings->save('site.name', 'Example Site');
$name = $settings->get('site.name');

Provide these repositories to the core package components that accept SettingRepositoryInterface and SettingChangeLogRepositoryInterface. See the usage example for a fuller example.

Tests

Run the package test suite from the repository root:

vendor/bin/phpunit --configuration phpunit.xml.dist