adachsoft / site-settings-json
JSON file repository adapters for the AdachSoft Site Settings package.
v0.1.0
2026-11-22 09:03 UTC
Requires
- php: ^8.3
- ext-json: *
- adachsoft/site-settings: ^0.1.0
Requires (Dev)
- adachsoft/php-code-style: ^0.7.3
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^12.5
- rector/rector: ^2.8
- symplify/phpstan-rules: ^14.19
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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