hexlet / trees
Trees implementation
Installs: 333
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 11
Forks: 11
Open Issues: 0
Requires
- php: >=7.4 || >=8.1
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.6
This package is not auto-updated.
Last update: 2025-01-13 03:21:01 UTC
README
Functions for working with trees.
Examples
<?php use function Php\Immutable\Fs\Trees\trees\mkdir; use function Php\Immutable\Fs\Trees\trees\mkfile; use function Php\Immutable\Fs\Trees\trees\getName; use function Php\Immutable\Fs\Trees\trees\isDirectory; use function Php\Immutable\Fs\Trees\trees\isFile; use function Php\Immutable\Fs\Trees\trees\map; isFile(mkfile('config')); // true isDirectory(mkdir('etc')); // true $tree = mkdir('etc', [mkfile('config'), mkfile('hosts')]); map(fn($node) => array_merge($node, ['name' => strtoupper(getName($node))]), $tree); // [ // name => 'ETC', // children => [ // [ name => 'CONFIG', meta => [], type => 'file' ], // [ name => 'HOSTS', meta => [], type => 'file' ] // ], // meta => [], // type => 'directory' // ]
This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet.
See most active contributors on hexlet-friends.