2017 © Pedro PelĂĄez
 

library hip

Ultra F***ing simple human readable data serialization.

image

mario-deluna/hip

Ultra F***ing simple human readable data serialization.

  • Saturday, May 23, 2015
  • by mario-deluna
  • Repository
  • 3 Watchers
  • 9 Stars
  • 197 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 5 % Grown

The README.md

Hip logo, (*1)

Human Input / Simple human readable data markup., (*2)

Build Status License, (*3)

name: "Hip"
type: "Markup language"
version: 1.0
tags: "markup", "serialization", "language"

Hip does not try to replace any data markups or create a new standard. The target of hip is to be readable and writable by non-technicals folks without out having to explain the syntax., (*4)

FAQ

  • Why should I use this? Sorry dude I don't know.. This data parser is an experiment and will maybe be implemented into the ClanCatsFramework 2.1. If you are looking for an approved and stable data serialization format use YAML. If you believe Hip could be useful, feel free, every user makes me happy :)

Installation

This Hip parser is written in PHP using PSR-4 autoloading you can install it using composer., (*5)

"require": 
{
    "mario-deluna/hip": "dev-master"
}

Usage

Encoding / Decoding

Decode a hip data string to an array:, (*6)

Hip\Hip::decode( $hipString );

Encode an array to a hip data string:, (*7)

Hip\Hip::decode( $myArray );

Reading / Writing files

Read hip file:, (*8)

Hip\Hip::read( 'my/path/to/file.hip' );

Write hip file:, (*9)

Hip\Hip::write( 'my/path/to/file.hip', $myArray );

Hip syntax

Simple key values

name: "Zaphod beeblebrox"
job: "President of the Galaxy"

wich equals, (*10)

{
    "name": "Zaphod beeblebrox",
    "job": "President of the Galaxy"
}

Multi layer

recipe:
    duration: 60
    ingredients: "eggs", "bacon", "cream", "leek"

wich equals, (*11)

{
    "recipe": 
    {
        "duration": 60,
        "ingredients": [ "eggs", "bacon", "cream", "leek" ]
    } 
}

Array lists

instruments:
    -
    name: "Guitar"
    strings: 6
    --
    name: "Bass"
    strings: 4
    -

wich equals, (*12)

{
    "instruments": 
    [
        {
            "name": "Guitar",
            "strings": 6
        },
        {
            "name": "Bass",
            "strings": 4
        }
    ] 
}

data types

string: "Hello World"
integer: 42
float: 3.14
yepBool: yes
nopeBool: no
nothing: nil

wich equals, (*13)

{
    "string": "Hello World",
    "integer": 42,
    "float": 3.14,
    "yepBool": true,
    "nopeBool": false,
    "nothing": null
}

TODO

  • Hip config object / utility
  • Automatic detect the level indicator ( space, tab etc. )
  • more tests...

The Versions

23/05 2015

dev-master

9999999-dev https://github.com/mario-deluna/Hip

Ultra F***ing simple human readable data serialization.

  Sources   Download

MIT

serialization data hip

23/01 2015

1.0.0

1.0.0.0 https://github.com/mario-deluna/Hip

Ultra F***ing simple human readable data serialization.

  Sources   Download

MIT

serialization data hip