adachsoft/sandbox-contracts

Shared sandbox contracts and value objects for file-based tools.

Maintainers

Package info

gitlab.com/a.adach/sandbox-contracts

Issues

pkg:composer/adachsoft/sandbox-contracts

Statistics

Installs: 2

Dependents: 1

Suggesters: 0

Stars: 0

v0.1.0 2026-04-08 15:14 UTC

This package is not auto-updated.

Last update: 2026-04-09 11:26:24 UTC


README

Shared sandbox contracts and value objects for AdachSoft file-based tools.

Installation

composer require adachsoft/sandbox-contracts

Usage

use AdachSoft\SandboxContracts\Factory\SandboxPathFactory;
use AdachSoft\SandboxContracts\Config\ArraySandboxExtractor;

// Direct creation
$factory = new SandboxPathFactory();
$sandbox = $factory->create('/mnt/php/projects/project_1/');
$fullPath = $sandbox->resolve('src/Service/MyService.php');
// "> "/mnt/php/projects/project_1/src/Service/MyService.php""

// From config array (e.g. inside a ToolFactory::create(ConfigMap $config))
$extractor = new ArraySandboxExtractor(new SandboxPathFactory());
$sandbox = $extractor->extract($config->toArray());

How consuming libraries should use this

In any ToolFactory or workflow step that needs a sandbox:

  1. Accept ArraySandboxExtractorInterface via constructor (DI preferred) OR instantiate ArraySandboxExtractor directly as convenience.
  2. Call $sandbox = $this->extractor->extract($config->toArray()).
  3. Pass $sandbox into the tool/step

    - never pass raw base_path string further.

  4. Inside the tool/step call $sandbox->resolve($userProvidedPath) before any file operation.