rmb32 / barnscaff
Filesystem projection for Barncept concept graphs
Requires
- php: ^8.5
- ext-ds: ^2.0
- php-ds/php-ds: ^2.0
- rmb32/barncept: ^5.0
Requires (Dev)
- infection/infection: ^0.35.4
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^13.3
- rector/rector: ^2.6
- squizlabs/php_codesniffer: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Part of Barn.
Turn a Barncept concept graph into real folders and files — and
check that an existing folder still matches it. Use it from PHP, or from the
command line via barnscaff-cli.
Requirements
- PHP 8.5+
- The
dsextension,^2.0 rmb32/barncept,^5.0
Installation
composer require rmb32/barnscaff
Command line
Install barnscaff-cli to get barnscaff:
composer require rmb32/barnscaff-cli
vendor/bin/barnscaff scaffold Library Root ./generated # preview the plan
vendor/bin/barnscaff scaffold Library Root ./generated --apply # write it
vendor/bin/barnscaff scan Library Root ./generated # exit 0 if conformant, 1 otherwise
PHP usage
use Rmb32\Barncept\Api\Factory\ConceptFactory;
use Rmb32\Barncept\Api\Factory\ResolverFactory;
use Rmb32\Barncept\Api\ValueObject\Key\ChoiceKey;
use Rmb32\Barnscaff\Api\Factory\ScaffolderFactory;
use Rmb32\Barnscaff\Api\Factory\ScannerFactory;
$concept = new ConceptFactory()->create($data);
$instance = new ResolverFactory()->create()
->resolve($concept, ChoiceKey::new('Root'));
$scaffolder = new ScaffolderFactory()->create();
$plan = $scaffolder->plan($instance, '/path/to/project');
$scaffolder->apply($plan); // writes to disk
$report = new ScannerFactory()->create()->scan($instance, '/path/to/project');
$report->isConformant(); // true
Each Part becomes a folder. Each Choice becomes a folder, or a .php file when nothing sits beneath it,
and the Choices that fill one Slot are grouped in a folder named after that Slot's key. Barnscaff never
reads a concept file itself: load one, and compose it if it borrows, with Barncept's
ConceptRegistryFactory and ConceptComposerFactory.
Related packages
- Barncept — defines the concepts and resolves them into the graph Barnscaff realises.
- Barnscaff CLI — the
barnscaff scaffold/barnscaff scancommands. - Barnark — architecture templates, built on Barncept and Barnscaff.
More docs
Internals · History · Known issues
License
Proprietary. See LICENSE. Copyright (c) Roger Barnfather.