Download the PHP package nette/neon without Composer

On this page you can find all versions of the php package nette/neon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package neon

NEON

Downloads this Month Tests Coverage Status Latest Stable Version License

 <!---->

✅ A NEON parser that keeps [every comment and space](#the-tree-nodes-slots-tokens-trivia)
✅ [Edit a configuration file](#format-preserving-editing) and the diff is only your change
✅ [Your own values](#your-own-values-the-evaluator) for entities, constants or parameters
✅ [`neon-lint`](#for-editors-ci-and-ai-agents) for editors, CI and AI agents

 <!---->

NEON parser, encoder and lossless editor for PHP. NEON is the human-friendly configuration format of the Nette framework, a YAML alternative with entities. This library parses it into a concrete syntax tree in which every character of the file has its place, so printing the tree gives the file back byte for byte:

That is what makes editing safe. Change a value, add a key, remove an item, and the rest of the file stays as its author wrote it:

On that you build configuration editors and admin panels, installers that register an extension in config.neon, migrations that rename a service, and AI agents that change configuration without wrecking it.

 <!---->

Support Neon

Do you like NEON? Are you looking forward to the new features?

Buy me a coffee

Thank you!

 <!---->

NEON in one minute

JSON is a subset of NEON, except for a colon at the start of a line glued to its value ("a" + new line + :1), which NEON reads as a literal. The format is described in the manual, and you can try it in the sandbox.

▶ Runnable examples: examples/edge-cases

 <!---->

Installation

It requires PHP 8.4 up to 8.6 with the json and mbstring extensions.

 <!---->

Decoding and encoding

NEON PHP
null, true, yes ... null, bool
integer int, beyond the 64-bit range a string of its digits
float float
string string
date DateTimeImmutable; an invalid date such as 2024-02-30 stays a string
entity, chain Nette\Neon\Entity
list, map array

Errors throw Nette\Neon\Exception with the position of the problem. What encode() cannot write without loss, such as invalid UTF-8, INF or a cycle, is an error that names the path to the value.

▶ Runnable examples: examples/encoding

 <!---->

Format-preserving editing

Every edit changes the tokens it edits and nothing else, and the guarantees of the specification (the file reads back as the same tree, with the expected value, with the change only where it was made) are checked after every operation of a large corpus of edits.

A missing key in the middle of a path is an error, so a typo does not create a new section. Removing the last item of a collection leaves it empty (services: []), because in a configuration empty and missing often mean different things; an item marked nullable loses its value instead. A refused edit changes nothing, not even half of itself.

▶ Runnable examples: examples/config-editor

 <!---->

The tree: nodes, slots, tokens, trivia

Eight node classes (DocumentNode, BlockArrayNode, InlineArrayNode, ArrayItemNode, EntityNode, EntityChainNode, StringNode, LiteralNode) with named slots, tokens with their trivia (whitespace, line endings, comments), find(), findAncestor(), siblings, and Traverser for a walk with replacements.

▶ Runnable examples: examples/tree

 <!---->

Your own values: the Evaluator

Neon::decode() is the tree projected onto PHP values by Nette\Neon\Evaluator. A subclass changes how literals, strings, entities and items become values, while the keys and the order of the arrays stay those of the document; that is how the DI container of Nette reads its configuration.

▶ Runnable examples: examples/evaluator

 <!---->

For editors, CI and AI agents

One line per finding, the exit code as the verdict (0 valid, 1 findings, 2 a failure of the tool), --json for tools, --check to verify that the file reads back byte for byte. An AI agent that runs it after it saves a .neon file fixes a broken one before it goes on.

▶ Runnable examples: examples/linting

 <!---->

One format, one specification

The format, the value model, the tree and the semantics of editing are written down in a language-neutral specification with a conformance corpus, and every implementation runs that corpus in its tests. The same specification is implemented for JavaScript and TypeScript by @nette/neon; the two implementations were checked against each other and against nette/neon 3.4 over tens of thousands of real-world files.

 <!---->

Upgrading from 3.x

Neon::decode(), decodeFile() and encode() work as before and give the same values. What changed:

 <!---->

Limits

 <!---->

Documentation

The examples are the documentation of the API, each chapter with the real output of its programs. The format itself is documented in the Nette manual.


All versions of neon with dependencies

PHP Build Version
Package Version
Requires php Version 8.4 - 8.6
ext-json Version *
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nette/neon contains the following files

Loading the files please wait ...