forrest79 / composer-yaml-neon-plugin
Plugin to use composer config file in YAML or NEON format.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:composer-plugin
pkg:composer/forrest79/composer-yaml-neon-plugin
Requires
- php: ^8.2
- composer-plugin-api: ^2.6
- nette/neon: ^3.4
- symfony/yaml: ^7.2
Requires (Dev)
- composer/composer: ^2.8
- forrest79/phpcs: ^1.5
- forrest79/phpcs-ignores: ^0.5
- phpstan/phpstan: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
This package is auto-updated.
Last update: 2025-10-17 21:06:37 UTC
README
tl;dr
Plugin to use Composer with the config file in YAML (composer.yaml/composer.yml) or NEON (composer.neon) format instead of JSON.
Installation
This plugin must be installed globally:
$ composer global require forrest79/composer-yaml-neon-plugin && composer global update
It is recommended to disable use-parent-dir to omit question No composer.json in current directory, do you want to use the one at ...? where there is a config file in a YAML or NEON format and in some parent directory is a config file in JSON format.
$ composer config --global use-parent-dir false
How to use it
Prepare a config file composer.yaml/composer.yml (for the YAML format), or composer.neon (for the NEON format) instead of composer.json.
Different config file/path via environment variable
COMPOSERis also supported. Don't point directly to aYAMLorNEONconfig file, always point to the (virtual)JSONconfig file and let plugin detect correct config file.
For example YAML format:
# You can use comments... name: forrest79/composer-yaml-neon-plugin # ...or this comments authors: - name: 'Jakub Trmota' email: jakub@trmota.cz require: composer/composer: 2.3.6 php: '>=8.0' require-dev: squizlabs/php_codesniffer: ^3.5 autoload: psr-4: Forrest79\ComposerYamlNeonPlugin\: src bin: - bin/composer scripts: phpcs: 'vendor/bin/phpcs -s src' config: allow-plugins: dealerdirect/phpcodesniffer-composer-installer: false
or NEON format:
# You can use comments...
name: forrest79/composer-yaml-neon-plugin # ...or this comments
authors:
-
name: Jakub Trmota
email: jakub@trmota.cz
require:
composer/composer: '2.3.6'
php: '>=8.0'
require-dev:
squizlabs/php_codesniffer: ^3.5
autoload:
psr-4:
Forrest79\ComposerYamlNeonPlugin\: src
bin:
- bin/composer
scripts:
phpcs: vendor/bin/phpcs -s src
config:
allow-plugins:
dealerdirect/phpcodesniffer-composer-installer: false
IMPORTANT: You can use only one config file in a directory.
Generate composer.json
To generate classic composer.json file, use composer generate-composer-json command.
How does it work?
Simply! If plugin detects YAML or NEON config file at the startup, it will generate composer.json and at the end is JSON file cleaned. That's the magic.
When composer.json is changed by Composer (i.e., after composer require command etc.), the new config file in YAML or NEON format is saved next to the original one, and you must make manual diff and merge.