evozon-php / composer-utilities
Composer utilities
Installs: 11 215
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:composer-plugin
Requires
- php: >=7.1
- composer-plugin-api: ^1.1
- symfony/console: ^4.0
- symfony/filesystem: ^4.0
- symfony/property-access: ^4.0
- symfony/yaml: ^4.0
This package is auto-updated.
Last update: 2025-03-09 01:10:13 UTC
README
Different Composer utilities for various use cases.
Installation
composer require evozon-php/composer-utilities --dev
Synchronize composer.json
When working on a monolith repository, you might have different .json
files.
In this case, there might one .json
file for development (i.e. dev.json
) which installs from local repositories and maybe also different releases. Another .json
file (i.e. composer.json
) would be used for installing packages from remote repositories and probably stable versions.
Add the following to your source .json
file:
{
"config": {
"composer-utilities": {
"sync": {
"ignore": {
"nodes": [
"[require][vendorAbc/packageAbc]",
"[require][vendorXyz/bundleXyz]",
"[repositories]"
]
}
}
}
}
}
All you need to do is to define the nodes you want to ignore during synchronization. Make sure you define them in PropertyAccess format.
The plugin will hook automatically to the post-install-cmd
and post-update-cmd
events and ask if you want to synchronize.
This will work only if you specifically use a custom .json
file:
COMPOSER=dev.json composer install
There is also a custom command added when you want to manually trigger the synchronization process:
composer sync:json --source dev.json --target composer.json
Force Update Parameters
Useful when some parameters change in parameters.yml.dist
but updating them parameters.yml
is tedious. Usually it's the case with array parameters.
Add the following to your composer.json
file:
{
"config": {
"composer-utilities": {
"parameters-update": {
"file": "app/config/parameters.yml",
"dist-file": "app/config/parameters.yml.dist",
"parameters": [
"foo",
"bar"
]
}
}
}
}
The plugin will hook automatically to the post-install-cmd
and post-update-cmd
events and ask if you want to update parameters.
composer install
// or
composer update
There is also a custom command added when you want to manually trigger parameters update process:
composer parameters:update --source app/config/parameters.yml.dist --target app/config/parameters.yml