rmb32 / barnscaff
Filesystem projection for Barntree Trees
Requires
- php: ^8.5
- ext-ds: ^2.0
- php-ds/php-ds: ^2.0
- rmb32/barntree: ^0.1@dev
Requires (Dev)
- infection/infection: ^0.35.4
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^13.3
- rector/rector: ^2.6
- rmb32/barn-paths: ^0.1@dev
- rmb32/typed-json: ^1.0@dev
- squizlabs/php_codesniffer: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Early, version 0.x. Not ready for real projects yet; the minor version is the breaking one.
Part of Barn.
Turn a Barntree Tree's item tree 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.
Map children are traversed alphabetically by display name through Barntree. Members of a list retain their sequence.
Requirements
- PHP 8.5+
- The
dsextension,^2.0 rmb32/barntree,^0.1
Installation
composer require rmb32/barnscaff
Command line
Install barnscaff-cli to get barnscaff:
composer require rmb32/barnscaff-cli
Run it inside a barn with a saved tree. The Barnscaff CLI quick start shows how to set one up with the bundled House tree.
vendor/bin/barnscaff scaffold House ./generated # preview the plan
vendor/bin/barnscaff scaffold House ./generated --apply # write it
vendor/bin/barnscaff scan House ./generated # exit 0 if conformant, 1 otherwise
PHP usage
use Rmb32\Barntree\Api\Factory\TreeFactory;
use Rmb32\Barnscaff\Api\Factory\ScaffolderFactory;
use Rmb32\Barnscaff\Api\Factory\ScannerFactory;
$tree = new TreeFactory()->create($data);
$scaffolder = new ScaffolderFactory()->create();
$plan = $scaffolder->plan($tree, '/path/to/project');
$scaffolder->apply($plan); // writes to disk
$report = new ScannerFactory()->create()->scan($tree, '/path/to/project');
$report->isConformant(); // true
The root item is the folder you name. Below it, each map and list item becomes a folder and each leaf
item a .php file, named by the item's name (a member's own, or its type's). Barnscaff never reads a
tree file itself: load one with Barntree's TreeFactory or TreeStoreFactory.
Related packages
- Barntree — defines the Trees whose item trees Barnscaff writes.
- Barnscaff CLI — the
barnscaff scaffold/barnscaff scancommands. - Barnark — architecture templates, built on Barntree.
More docs
Internals · History · Known issues
License
Proprietary. See LICENSE. Copyright (c) Roger Barnfather.