Skip to content
Skills Library
Programming · Learning & explanation

neon-format

/neon-format

Invoke before creating or modifying .neon files. Provides NEON syntax and Nette configuration conventions. Use when writing or editing .neon config files, asking about NEON syntax (entities, multiline strings, inline notation, special values, escaping), converting YAML to NEON, parsing or encoding NEON in PHP (Neon::decode, Neon::encode), running neon-lint, or debugging NEON syntax errors. For phpstan.neon, use the phpstan-analysis skill (from nette-dev plugin) instead. Do not trigger for Nette DI concepts like autowiring and service registration without .neon file context.

Author
nette ↗
Licence
MIT
Last repository change
25.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Invoke before creating or modifying .neon files. Provides NEON syntax and Nette configuration conventions. Use when writing or editing .neon config files, asking about NEON syntax (entities, multiline strings, inline notation, special values, escaping), converting YAML to NEON, parsing or encoding NEON in PHP (Neon::decode, Neon::encode), running neon-lint, or debugging NEON syntax errors. For phpstan.neon, use the phpstan-analysis skill (from nette-dev plugin) instead. Do not trigger for Nette DI concepts like autowiring and service registration without .neon file context.

Original author description

Invoke before creating or modifying .neon files. Provides NEON syntax and Nette configuration conventions. Use when writing or editing .neon config files, asking about NEON syntax (entities, multiline strings, inline notation, special values, escaping), converting YAML to NEON, parsing or encoding NEON in PHP (Neon::decode, Neon::encode), running neon-lint, or debugging NEON syntax errors. For phpstan.neon, use the phpstan-analysis skill (from nette-dev plugin) instead. Do not trigger for Nette DI concepts like autowiring and service registration without .neon file context.

How it works

  1. NEON Format
  2. PHP API
Original SKILL.md headings · 215 lines, 511 words
SKILL.md preview
---
name: neon-format
description: Invoke before creating or modifying .neon files. Provides NEON syntax and Nette configuration conventions. Use when writing or editing .neon config files, asking about NEON syntax (entities, multiline strings, inline notation, special values, escaping), converting YAML to NEON, parsing or encoding NEON in PHP (Neon::decode, Neon::encode), running neon-lint, or debugging NEON syntax errors. For phpstan.neon, use the phpstan-analysis skill (from nette-dev plugin) instead. Do not trigger for Nette DI concepts like autowiring and service registration without .neon file context.
---

## NEON Format

NEON (Nette Object Notation) is a human-readable data format used for configuration files in Nette. Similar to YAML but with support for entities and tab indentation.

```shell
composer require nette/neon
```

### Mappings

Key-value pairs with required space after colon:

```neon
street: 742 Evergreen Terrace
city: Springfield
country: USA
```

Inline notation with braces:

```neon
{street: 742 Evergreen Terrace, city: Springfield, country: USA}
```

### Sequences

Indexed arrays with hyphen and space:

```neon
- Cat
- Dog
- Goldfish
```

Inline notation with brackets:

```neon
[Cat, Dog, Goldfish]
```

### Nesting

Indentation defines structure:

```neon
pets:
	- Cat
	- Dog
cars:
	- Volvo
	- Skoda
```

Block and inline can be combined:

```neon
pets: [Cat, Dog]
cars:
	- Volvo
	- Skoda
```

### Strings

Unquoted, single-quoted, or double-quoted:

```neon
- An unquoted string
- 'Single-quoted string'
- "Double-quoted with \t escapes"
```

Quote strings containing: `# " ' , : = - [ ] { } ( )`

Double a quote to include it: `'It''s working'`

Multiline strings with triple quotes:

```neon
'''
	first line
		second line
	third line
'''
```

### Special Values

```neon
# Numbers
count: 12
price: 12.3
scientific: +1.2e-34
binary: 0b11010
octal: 0o666
hex: 0x7A

# Null
value: null
empty:

# Booleans
enabled: true
disabled: false
active: yes
inactive: no

# Dates (auto-converted to DateTimeImmutable)
date: 2016-06-03
datetime: 2016-06-03 19:00:00
with_tz: 2016-06-03 19:00:00 +02:00
```

### Entities

Function-like structures for DI configuration:

```neon
Column(type: int, nulls: yes)
```

Chained entities:

```neon
Column(type: int) Field(id: 1)
```

Multiline entity:

```neon
Column(
	type: int
	nulls: yes
)
```

### Comments

```neon
# This line is ignored
street: 742 Evergreen Terrace  # inline comment
```

### Block vs Inline Notation

Use **inline** for short, simple values (up to ~3 items):
```neon
extensions: [foo, bar]
roles: {admin: true, user: false}
```

Use **block** for anything complex, nested, or long:
```neon
services:
	- App\Model\UserService
	- App\Model\OrderService
```

### Key Rules

- Space after `:` is required (`key: value`, not `key:value`)
- Use **tabs** for indentation. Spaces are valid too (`Neon::encode()` just defaults to tabs);
  unlike YAML, NEON accepts either, so never "fix" space-indented NEON
- Block notation cannot be nested inside inline notation
- Unquoted strings cannot start/end with spaces or look like numbers/booleans/dates

## PHP API

```php
use Nette\Neon\Neon;
```

### encode(mixed $value, bool $blockMode=false, string $indentation="\t"): string

Converts PHP value to NEON. Pass `true` to `$blockMode` for multiline output.

```php
Neon::encode($value);       // inline NEON
Neon::encode($value, true); // multiline NEON
```

### decode(string $neon): mixed

Parses NEON string to PHP value. Dates become `DateTimeImmutable`, entities become `Nette\Neon\Entity`.

```php
Neon::decode('hello: world'); // ['hello' => 'world']
```

### decodeFile(string $file): mixed

Parses NEON file to PHP value (removes BOM).

```php
Neon::decodeFile('config.neon');
```

All methods throw `Nette\Neon\Exception` on error.

### Lint Command

Check syntax errors in `.neon` files:

```shell
vendor/bin/neon-lint <path>
```

### Documentation

The full Nette documentation for this topic is bundled with the plugin. Read a page when you need details beyond this skill:

- [NEON Format](../../docs/neon/format.md) – the complete syntax
- [Nette NEON](../../docs/neon/index.md) – `Neon::encode()`, `Neon::decode()`, the linter

Versions

The database has no other skills named neon-format.

Identical content appears in 1 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version 8ef17b128017 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100nette-configuration
    Invoke before configuring Nette DI – services, .neon files, autowiring. Provides service registration, autowiring, auto-discovery, factory and setup methods, parameter usage, decorator section, and framework configuration. Also trigger for resolving autowiring issues or organizing config files.
  • 100phpstan-analysis
    Invoke BEFORE running PHPStan or fixing PHPStan errors. Covers error resolution strategy (refactoring > phpDoc > ignoring), common Nette error patterns, baseline management, and type tests. Use this whenever the user mentions PHPStan, static analysis, type errors, wants to…
  • 100wp-phpstan-review
    WordPress PHPStan review and setup guidance. Use when reviewing `phpstan.neon`, WordPress static-analysis setup, baselines, PHPStan levels, CI jobs, WordPress stubs, `szepeviktor/phpstan-wordpress`, or when user mentions "PHPStan", "static analysis", "phpstan.neon", "baseline",…
  • 100wp-phpstan
    Use when configuring, running or fixing PHPStan in a WordPress project that uses Acorn - phpstan.neon, baseline, szepeviktor/phpstan-wordpress stubs, larastan, level raising, "Cannot access property on mixed", get_field() types, paths for app/. For Pint or Mago formatting use…
  • 100wp-phpstan
    Use when configuring, running, or fixing PHPStan static analysis in WordPress projects (plugins/themes/sites): phpstan.neon setup, baselines, WordPress-specific typing, and handling third-party plugin classes.
  • 100php-quality
    PHP static analysis, code style and modern idioms for PHP 8.3 to 8.5. Use when setting up phpstan.neon or a baseline, choosing PHPStan or Psalm, PHP-CS-Fixer or PHP_CodeSniffer, PER-CS or PSR-12, configuring Rector quality sets, or reviewing PHP for readonly, enums, property…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.