adachsoft / project-config-lib
A project configuration repository library with a JSON file backend.
Requires
- php: ^8.3
- ext-mbstring: *
- adachsoft/collection: ^3.0
Requires (Dev)
- adachsoft/php-code-style: ^0.8.0
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^13
- rector/rector: ^2.9
- symplify/phpstan-rules: ^14.19
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A PHP library for storing and managing project definitions in a JSON file. It provides a repository contract, a JSON file-backed implementation, immutable data objects, validated project identifiers and keywords, and paginated project listing.
Main capabilities
- Create, retrieve, update, and delete project definitions.
- Store project titles, descriptions, keywords, and extensible parameters.
- List all projects or retrieve a page of results.
- Persist configuration in a human-readable JSON file.
Installation
Install the library with Composer:
composer require adachsoft/project-config-lib
Integration
Create a JSON-backed repository by providing the path to its data file:
use AdachSoft\ProjectConfigLib\ProjectConfigRepositoryFactory;
use AdachSoft\ProjectConfigLib\Vo\ProjectIdVo;
$repository = (new ProjectConfigRepositoryFactory())
->createJsonFileRepository(__DIR__ . '/var/projects.json');
$projects = $repository->listAll();
$project = $repository->getById(new ProjectIdVo('my-project'));
The repository creates the containing directory when saving data if it does not already exist. See the usage example for creating and managing project definitions.
Usage
Create a project definition and persist it through the repository. Use the repository methods to retrieve, update, list, or delete definitions; see the linked example for a complete workflow.
Requirements
- PHP 8.3 or later.
- Composer for dependency installation and autoloading.