2017 © Pedro Peláez
 

composer-plugin composer-utilities

Composer utilities

image

evozon-php/composer-utilities

Composer utilities

  • Wednesday, November 29, 2017
  • by frozenminds
  • Repository
  • 4 Watchers
  • 0 Stars
  • 2,978 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 14 % Grown

The README.md

Composer Utilities

Different Composer utilities for various use cases., (*1)

Installation

composer require evozon-php/composer-utilities --dev

Synchronize composer.json

When working on a monolith repository, you might have different .json files., (*2)

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., (*3)

Add the following to your source .json file:, (*4)

{
  "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., (*5)

The plugin will hook automatically to the post-install-cmd and post-update-cmd events and ask if you want to synchronize., (*6)

This will work only if you specifically use a custom .json file:, (*7)

COMPOSER=dev.json composer install

There is also a custom command added when you want to manually trigger the synchronization process:, (*8)

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., (*9)

Add the following to your composer.json file:, (*10)

{
  "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., (*11)

composer install
// or
composer update

There is also a custom command added when you want to manually trigger parameters update process:, (*12)

``` composer parameters:update --source app/config/parameters.yml.dist --target app/config/parameters.yml, (*13)

The Versions