nette/neon
NEON is Nette’s human-friendly data serialization format and parser for PHP. It offers a clean syntax for configuration files, supports comments, multiline strings and typed values, and converts NEON to/from PHP arrays and objects with reliable error reporting.
Architecture fit:
Poor alignment with Laravel’s native config stack (PHP arrays, YAML, JSON). NEON’s human-readable syntax and Nette-specific features (e.g., AST parsing, DateTimeImmutable generation) introduce unnecessary complexity for Laravel’s ecosystem. The package’s standalone nature and lack of Laravel integration hooks (e.g., config() helper, config:cache) make it a non-native dependency. While v3.4.x’s phpDoc improvements enhance IDE support, they do not resolve the core architectural mismatch.
Integration feasibility: Technically possible but high-effort due to:
Neon::decodeFile() in a service provider) to bridge NEON and Laravel’s config() system.0o777, """ multiline strings) clash with Laravel’s permissive YAML/JSON handling.config:cache may fail if NEON configs are dynamically modified post-caching (e.g., Neon::decodeFile()’s atomicity is irrelevant here).Technical risk:
on/off syntax, DateTimeImmutable generation), despite being marked as non-breaking in v3.4.8.Key questions:
file_get_contents() + yaml_parse(). Is this acceptable for the use case?Neon::encode() edge cases) if the Nette team deprioritizes Laravel support?Stack fit: Mismatched. Laravel’s config system is optimized for:
Illuminate/Config and config:cache.config('key') access with no parsing overhead..env integration via Illuminate/Foundation.NEON’s Nette-centric features (e.g., DateTimeImmutable decoding, entity chaining) are irrelevant to Laravel’s use cases. The v3.4.x phpDoc improvements do not address this gap.
Migration path: Not viable for Laravel core configs. Options:
NeonConfigLoader service.
// app/Providers/NeonConfigServiceProvider.php
public function register()
{
$this->app->bind('neon', function () {
return new NeonConfigLoader(base_path('config/neon'));
});
}
neon:config → Laravel’s config()).Neon::decode()/Neon::encode(), but never for Laravel’s core configs.Compatibility:
config:cache may fail if NEON configs are modified post-cache (e.g., during runtime). Workaround: Exclude NEON files from caching or use Neon::decodeFile() dynamically.Sequencing:
config:cache compatibility, UTF-8 handling, and static analysis tooling.Maintenance:
Neon::decodeFile() failing silently on invalid UTF-8.config:cache ignoring NEON files or throwing errors.config() helper support).Support:
laravel-neon wrappers). Support is Nette-focused, leaving Laravel teams to debug integration issues alone.0o777, """ strings), increasing onboarding time.INF/NAN encoding throws) may confuse Laravel teams expecting Symfony-style errors.Scaling:
Neon::decodeFile()’s atomicity is irrelevant in Laravel’s file-caching model. Risk: Race conditions if multiple processes read/write NEON configs simultaneously..neon files in config/), unlike Laravel’s .env system.Failure modes:
INF) may be silently replaced (v3.4.7’s U+FFFD fallback), leading to runtime bugs.config:cache may ignore NEON files or fail if they’re modified post-cache. Workaround: Exclude NEON files from caching or use dynamic loading.Ramp-up:
0b11001, """ strings) and tooling (e.g., neon-lint).neon-lint) to catch syntax errors early.How can I help you explore Laravel packages today?