Skip to content

celestora/indents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Indents

Indented string example

A small library to help you parse and generate indented strings.

Codeship Status for kfcjew/indents CodeFactor

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

About

Indented strings parser & generator.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published