neon sandbox

This is neon file - try to edit it!

This is result

array (8)
name => "Homer" (5) address => array (3)
| street => "742 Evergreen Terrace" (21) | city => "Springfield" (11) | country => "USA" (3)
phones => array (2)
| home => "555-6528" (8) | work => "555-7334" (8)
children => array (3)
| 0 => "Bart" (4) | 1 => "Lisa" (4) | 2 => "Maggie" (6)
entity => Nette\Neon\Entity #4426
| value => "Column" (6) | attributes => array (2)
| | type => "int" (3) | | nulls => true
string => "quotes string" (13) "multi line string" => "one line second line third line" (31) "special types" => array (9)
| "escape sequences" => "\xe2\x80\xa6 \t \n \r \x0c \x08 e" (15) | bool => array (2)
| | 0 => true | | 1 => false
| "bool alternative" => array (2)
| | 0 => true | | 1 => false
| "exponent number" => 123450000.0 | "hex number" => 43777 | "octal number" => 438 | "binary number" => 231 | date => DateTimeImmutable #0ec0
| | date => "2020-02-02 00:00:00.000000" (26) | | timezone_type => 3 | | timezone => "Europe/Prague" (13)
| "date time" => DateTimeImmutable #5b75
| | date => "2020-02-02 12:34:56.000000" (26) | | timezone_type => 3 | | timezone => "Europe/Prague" (13)

Libraries

NEON for PHP for JavaScript for Python

…or install using composer require nette/neon

Integrations

Configuration written in JSON?

{
"php": {
    "date.timezone": "Europe\/Prague",
    "zlib.output_compression": true
},
"database": {
    "driver": "mysql",
    "username": "root",
    "password": "beruska92"
},
"users": [
    "Dave", "Kryten", "Rimmer"
]
}

What if we could omit quotes?

{
php: {
    date.timezone: Europe/Prague,
    zlib.output_compression: true
},
database: {
    driver: mysql,
    username: root,
    password: beruska92
},
users: [
    Dave, Kryten, Rimmer
]
}

How about braces and commas?

php:
    date.timezone: Europe/Prague
    zlib.output_compression: true

database:
    driver: mysql
    username: root
    password: beruska92

users: [
    Dave, Kryten, Rimmer
]

Are bullets more legible?

php:
    date.timezone: Europe/Prague
    zlib.output_compression: true

database:
    driver: mysql
    username: root
    password: beruska92

users:
    - Dave
    - Kryten
    - Rimmer

How about comments?

# my web application config

php:
    date.timezone: Europe/Prague
    zlib.output_compression: yes  # use gzip

database:
    driver: mysql
    username: root
    password: beruska92

users:
    - Dave
    - Kryten
    - Rimmer

You found neon syntax!

NEON is very similar to YAML.The main difference is that the NEON supports entities (so can be used e.g. to parse phpDoc annotations, DI services, …) and both spaces and tabs for indentation. NEON syntax is a little simpler and the parsing is faster.