nette/neon
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Nette Neon is a human-readable structured data format utilized for configuration files in the Nette framework. The Nette Neon package offers the functionality to encode and decode data in the NEON file format. The easy-to-use package boasts a simplicity superior to XML or JSON, making data more understandable and structured in a YAML-like format. It also provides an added benefit of entities, enhancing the configuration of DI services.
To use nette/neon, you first need to install the package using Composer with the command composer require nette/neon
. It requires PHP versions from 8.0 up to 8.3. Once installed, you can use the Neon::encode()
to convert your data to NEON, with options for multiline output and specific indentation characters. To convert NEON to PHP value, use Neon::decode()
. Here's an example code:
use Nette\Neon\Neon;
// Encoding to NEON
$neon = Neon::encode($value); // Returns $value converted to NEON
$neon = Neon::encode($value, true); // Returns $value converted to multiline NEON
// Decoding from NEON
$value = Neon::decode('hello: world'); // Returns an array ['hello' => 'world']
All methods throw a Nette\Neon\Exception
on error, ensuring any issues in encoding or decoding are flagged.
The documentation for using nette/neon can be found on the Nette website. This comprehensive guide dives into the various aspects of using Nette Neon. It details examples of different data types and their representation in NEON, along with step-by-step instructions on encoding and decoding data. It further covers error handling and provides details on the usage of entities in NEON.