maximizer / indents
Indented string parser and generator
dev-master
2019-04-29 17:42 UTC
Requires
- php: >=7.1
Requires (Dev)
- peridot-php/peridot: ^1.19
- webmozart/assert: ^1.3
This package is auto-updated.
Last update: 2025-03-14 10:12:20 UTC
README
A small library to help you parse and generate indented strings.
Indented strings vs YAML
YAML is a full-featured markup language, while indented strings have only two base datatypes: Object node and string/int/float.
Indented strings are great for:
- Taxonomic data
- Directory structure
- Lists
But YAML would be a better choice, if you need to store:
- Configuration file
- Complicated data
Usage
Installing
composer require maximizer/indents
Parsing
<?php use Maximizer\Indentations\Indents; $parser = new Indents; $parser->parseFromFile("myFile.xis", Indents::TO_ASSOC); $parser->parseFromString("", Indents::TO_ASSOC);
Generating
<?php use Maximizer\Indentations\IndentGenerator; $array = [ "root" => [ "a", "b", "c" => ["d", "e"], ], ]; $gen = new IndentGenerator; $gen->generate($array);
License
ISC License