Simple patches plugin for Composer

Overview

composer-patches

Build Status Coverage Status

Simple patches plugin for Composer. Applies a patch from a local or remote file to any package required with composer.

Support notes

  • If you need PHP 5.3, 5.4, or 5.5 support, you should probably use a 1.x release.
  • 1.x is mostly unsupported, but bugfixes and security fixes will still be accepted. 1.7.0 will be the last minor release in the 1.x series.
  • Beginning in 2.x, the automated tests will not allow us to use language features that will cause syntax errors in PHP 5.6 and later. The unit/acceptance tests do not run on anything earlier than PHP 7.1, so while pull requests will be accepted for those versions, support is on a best-effort basis.

Usage

Before you begin, make sure that patch is installed on your system.

Example composer.json:

{
  "require": {
    "cweagans/composer-patches": "~1.0",
    "drupal/core-recommended": "^8.8",
  },
  "config": {
    "preferred-install": "source"
  },
  "extra": {
    "patches": {
      "drupal/core": {
        "Add startup configuration for PHP server": "https://www.drupal.org/files/issues/add_a_startup-1543858-30.patch"
      }
    }
  }
}

Using an external patch file

Instead of a patches key in your root composer.json, use a patches-file key.

{
  "require": {
    "cweagans/composer-patches": "~1.0",
    "drupal/core-recommended": "^8.8",
  },
  "config": {
    "preferred-install": "source"
  },
  "extra": {
    "patches-file": "local/path/to/your/composer.patches.json"
  }
}

Then your composer.patches.json should look like this:

{
  "patches": {
    "vendor/project": {
      "Patch title": "http://example.com/url/to/patch.patch"
    }
  }
}

Allowing patches to be applied from dependencies

If you want your project to accept patches from dependencies, you must have the following in your composer file:

{
  "require": {
      "cweagans/composer-patches": "^1.5.0"
  },
  "extra": {
      "enable-patching": true
  }
}

Ignoring patches

There may be situations in which you want to ignore a patch supplied by a dependency. For example:

  • You use a different more recent version of a dependency, and now a patch isn't applying.
  • You have a more up to date patch than the dependency, and want to use yours instead of theirs.
  • A dependency's patch adds a feature to a project that you don't need.
  • Your patches conflict with a dependency's patches.
{
  "require": {
    "cweagans/composer-patches": "~1.0",
    "drupal/core-recommended": "^8.8",
    "drupal/lightning": "~8.1"
  },
  "config": {
    "preferred-install": "source"
  },
  "extra": {
    "patches": {
      "drupal/core": {
        "Add startup configuration for PHP server": "https://www.drupal.org/files/issues/add_a_startup-1543858-30.patch"
      }
    },
    "patches-ignore": {
      "drupal/lightning": {
        "drupal/panelizer": {
          "This patch has known conflicts with our Quick Edit integration": "https://www.drupal.org/files/issues/2664682-49.patch"
        }
      }
    }
  }
}

Using patches from HTTP URLs

Composer blocks you from downloading anything from HTTP URLs, you can disable this for your project by adding a secure-http setting in the config section of your composer.json. Note that the config section should be under the root of your composer.json.

{
  "config": {
    "secure-http": false
  }
}

However, it's always advised to setup HTTPS to prevent MITM code injection.

Patches containing modifications to composer.json files

Because patching occurs after Composer calculates dependencies and installs packages, changes to an underlying dependency's composer.json file introduced in a patch will have no effect on installed packages.

If you need to modify a dependency's composer.json or its underlying dependencies, you cannot use this plugin. Instead, you must do one of the following:

  • Work to get the underlying issue resolved in the upstream package.
  • Fork the package and specify your fork as the package repository in your root composer.json
  • Specify compatible package version requirements in your root composer.json

Error handling

If a patch cannot be applied (hunk failed, different line endings, etc.) a message will be shown and the patch will be skipped.

To enforce throwing an error and stopping package installation/update immediately, you have two available options:

  1. Add "composer-exit-on-patch-failure": true option to the extra section of your composer.json file.
  2. Export COMPOSER_PATCHES_EXIT_ON_PATCH_FAILURE=1

By default, failed patches are skipped.

Patching composer.json in dependencies

This doesn't work like you'd want. By the time you're running composer install, the metadata from your dependencies' composer.json has already been aggregated by packagist (or whatever metadata repo you're using). Unfortunately, this means that you cannot e.g. patch a dependency to be compatible with an earlier version of PHP or change the framework version that a plugin depends on.

@anotherjames over at @computerminds wrote an article about how to work around that particular problem for a Drupal 8 -> Drupal 9 upgrade:

Apply Drupal 9 compatibility patches with Composer (archive)

Difference between this and netresearch/composer-patches-plugin

  • This plugin is much more simple to use and maintain
  • This plugin doesn't require you to specify which package version you're patching
  • This plugin is easy to use with Drupal modules (which don't use semantic versioning).
  • This plugin will gather patches from all dependencies and apply them as if they were in the root composer.json

Contributing

  1. composer install
  2. vendor/bin/grumphp run
  3. vendor/bin/codecept run unit
  4. <write code>
  5. vendor/bin/grumphp run
  6. vendor/bin/codecept run unit
  7. <commit code>
  8. <create pull request>

Credits

A ton of this code is adapted or taken straight from https://github.com/jpstacey/composer-patcher, which is abandoned in favor of https://github.com/netresearch/composer-patches-plugin, which is (IMHO) overly complex and difficult to use.

Comments
  • Breaks with Git 2.14.0

    Breaks with Git 2.14.0

    Using Git 2.14.0 breaks appying Patches (Alpine Edge, Composer 1.5). Latest Working Version is 2.13.4.

    Applying patches for drupal/core
        https://www.drupal.org/files/issues/2551373-35.patch (...)
    cd 'web/core' && git --git-dir=. apply --check '-p1' '/tmp/5989b7ae422cc.patch'
    warning: unable to access 'config': Is a directory
    warning: unable to access 'config': Is a directory
    fatal: unknown error occurred while reading the configuration files
    
    cd 'web/core' && git --git-dir=. apply --check '-p0' '/tmp/5989b7ae422cc.patch'
    warning: unable to access 'config': Is a directory
    
    warning: unable to access 'config': Is a directory
    fatal: unknown error occurred while reading the configuration files
    
    cd 'web/core' && git --git-dir=. apply --check '-p2' '/tmp/5989b7ae422cc.patch'
    warning: unable to access 'config': Is a directory
    warning: unable to access 'config': Is a directory
    fatal: unknown error occurred while reading the configuration files
    
    patch '-p1' --no-backup-if-mismatch -d 'web/core' < '/tmp/5989b7ae422cc.patch'
    patch: unrecognized option: no-backup-if-mismatch
    
    BusyBox v1.25.1 (2016-10-26 16:15:20 GMT) multi-call binary.
    
    Usage: patch [OPTIONS] [ORIGFILE [PATCHFILE]]
    
    	-p,--strip N		Strip N leading components from file names
    	-i,--input DIFF		Read DIFF instead of stdin
    	-R,--reverse		Reverse patch
    	-N,--forward		Ignore already applied patches
    	-E,--remove-empty-files	Remove output files if they become empty
    
    patch '-p0' --no-backup-if-mismatch -d 'web/core' < '/tmp/5989b7ae422cc.patch'
    patch: unrecognized option: no-backup-if-mismatch
    
    BusyBox v1.25.1 (2016-10-26 16:15:20 GMT) multi-call binary.
    
    Usage: patch [OPTIONS] [ORIGFILE [PATCHFILE]]
    
    	-p,--strip N		Strip N leading components from file names
    	-i,--input DIFF		Read DIFF instead of stdin
    	-R,--reverse		Reverse patch
    	-N,--forward		Ignore already applied patches
    	-E,--remove-empty-files	Remove output files if they become empty
    
    patch '-p2' --no-backup-if-mismatch -d 'web/core' < '/tmp/5989b7ae422cc.patch'
    patch: unrecognized option: no-backup-if-mismatch
    
    BusyBox v1.25.1 (2016-10-26 16:15:20 GMT) multi-call binary.
    
    Usage: patch [OPTIONS] [ORIGFILE [PATCHFILE]]
    
    	-p,--strip N		Strip N leading components from file names
    	-i,--input DIFF		Read DIFF instead of stdin
    	-R,--reverse		Reverse patch
    	-N,--forward		Ignore already applied patches
    	-E,--remove-empty-files	Remove output files if they become empty
    
       Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2551373-35.patch
    

    In the Release Notes (https://github.com/git/git/blob/master/Documentation/RelNotes/2.14.0.txt) are changes to "gitdir" and "git apply", maybe its one of them?

    opened by joergLin 24
  • Packages are getting deleted and not reinstalled since Composer 2.1.0

    Packages are getting deleted and not reinstalled since Composer 2.1.0

    Since Composer 2.1.0 when running composer install we're sometimes seeing packages that need patches getting deleted and not reinstalled.

    $ composer install
    Gathering patches from patch file.
    Removing package drupal/redis so that it can be re-installed and re-patched.
      - Removing drupal/redis (1.5.0)
    Installing dependencies from lock file (including require-dev)
    Verifying lock file contents can be installed on current platform.
    Nothing to install, update or remove
    Deleting app/modules/contrib/redis - deleted
    

    Running composer install a second time resolves the issue.

    $ composer install
    Gathering patches from patch file.
    Installing dependencies from lock file (including require-dev)
    Verifying lock file contents can be installed on current platform.
    Package operations: 1 install, 0 updates, 0 removals
    Gathering patches from patch file.
    Gathering patches for dependencies. This might take a minute.
      - Installing drupal/redis (1.5.0): Extracting archive
      - Applying patches for drupal/redis
    ...
    
    opened by mstrelan 22
  • Apply patch on root folder

    Apply patch on root folder

    Is there any way to apply a patch the root of the project, not specifically targeting a package. Currently I couldn't any documentation about this. Is this supported in any form or way?

    opened by tomasnagy 22
  • Applying Patches Drupal8: [ErrorException] Array to string conversion

    Applying Patches Drupal8: [ErrorException] Array to string conversion

    I just updated core to 8.3.1 and updated modules and everything and ran composer update multiple times to get all things updated.

    Then after few updates, I started to get this error.

    Exception trace:
     () at /var/www/drupalvm/vendor/cweagans/composer-patches/src/Patches.php:296
     Composer\Util\ErrorHandler::handle() at /var/www/drupalvm/vendor/cweagans/composer-patches/src/Patches.php:296
     cweagans\Composer\Patches->postInstall() at n/a:n/a
     call_user_func() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:171
     Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:116
     Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent() at phar:///usr/bin/composer/src/Composer/Installer.php:605
     Composer\Installer->doInstall() at phar:///usr/bin/composer/src/Composer/Installer.php:223
     Composer\Installer->run() at phar:///usr/bin/composer/src/Composer/Command/UpdateCommand.php:158
     Composer\Command\UpdateCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:267
     Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:846
     Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:191
     Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:227
     Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:122
     Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:100
     Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:54
     require() at /usr/bin/composer:24
    

    I then added some debugging print_r's to Patches.php.

    I printed content of that $url variable inside the patching loop @ line 288 of Patches.php.

    And this is what I got:

    Array
    (
        [0] => https://www.drupal.org/files/issues/core_path-alias_manager-language_fallback_and_test-2802403-45-D8.patch
        [1] => https://www.drupal.org/files/issues/core_path-alias_manager-language_fallback_and_test-2802403-45-D8.patch
    )
    

    It seems that those patches do get parsed twice, it doesn't matter what files I try to patch, the result is always the same.

    Any idea on what might be causing this behavior?

    Here's my composer.json with some privacy edits.

    {
        "name": "drupal-composer/drupal-project",
        "description": "Project template for Drupal 8 projects with composer",
        "type": "project",
        "license": "GPL-2.0+",
        "authors": [
            {
                "name": "",
                "role": ""
            }
        ],
        "repositories": [
            {
                "type": "composer",
                "url": "https://packages.drupal.org/8"
            },
            {
                "type": "vcs",
                "url": "[email protected]:XXX/XXXX"
            }
        ],
        "require": {
            "composer/installers": "^1.2",
            "drupal-composer/drupal-scaffold": "^2.2",
            "cweagans/composer-patches": "~1.0",
            "drupal/core": "~8.0",
            "drush/drush": "~8.0",
            "drupal/console": "~1.0",
            "drupal/admin_toolbar": "^1.0",
            "drupal/better_normalizers": "dev-1.x",
            "drupal/blazy": "^1.0",
            "drupal/breakpoint_js_settings": "^1.0",
            "drupal/config_update": "^1.0",
            "drupal/crop": "1.2",
            "drupal/ctools": "^3.0",
            "drupal/dropzonejs": "1.0-alpha6",
            "drupal/entity": "^1.0",
            "drupal/entity_browser": "1.0-rc2",
            "drupal/entity_reference_revisions": "^1.0",
            "drupal/field_group": "^1.0",
            "drupal/focal_point": "^1.0",
            "drupal/google_analytics": "^2.0",
            "drupal/inline_entity_form": "^1.0",
            "drupal/libraries": "dev-3.x",
            "drupal/linkit": "4.1",
            "drupal/media_entity": "1.6",
            "drupal/media_entity_instagram": "1.2",
            "drupal/media_entity_image": "^1.0",
            "drupal/media_entity_slideshow": "^1.0",
            "drupal/media_entity_twitter": "^1.0",
            "drupal/media_expire": "^1.0",
            "drupal/metatag": "1.x-dev",
            "drupal/paragraphs": "1.0",
            "drupal/pathauto": "^1.0@RC",
            "drupal/scheduler": "^1.0",
            "drupal/simple_sitemap": "2.x-dev",
            "drupal/slick": "^1.0",
            "drupal/slick_media": "^1.0",
            "drupal/token": "^1.0",
            "drupal/video_embed_field": "^1.0",
            "drupal/views_load_more": "dev-1.x",
            "drupal/coffee": "^1.0@beta",
            "zurb/foundation": "^6.3",
            "drupal/module_filter": "^3.0",
            "drupal/ckeditor_media_embed": "^1.0",
            "drupal/ckeditor_font": "^1.0",
            "drupal/search_api": "^1.0@beta",
            "drupal/entity_embed": "^1.0@beta",
            "drupal/file_browser": "^1.0@alpha",
            "drupal/devel": "^1.0@RC",
            "drupal/iframe": "^1.6",
            "drupal/shield": "^1.0",
            "mekanismi/ckeditor_responsive_foundation": "dev-master",
            "drush/config-extra": "^1.0",
            "drupal/fpa": "2.x-dev",
            "drupal/adminimal_theme": "^1.3",
            "drupal/twig_xdebug": "^1.0",
            "drupal/menu_block_current_language": "^1.0@RC",
            "drupal/viewsreference": "^1.0@alpha",
            "ajgl/breakpoint-twig-extension": "^0.3.0",
            "drupal/google_tag": "1.x-dev",
            "drupal/rules": "3.x-dev",
            "drupal/contact_block": "^1.3",
            "drupal/contact_storage": "^1.0@beta",
            "drupal/swiftmailer": "^1.0@beta",
            "drupal/filefield_paths": "^1.0@beta",
            "drupal/redirect": "^1.0@alpha",
            "drupal/eu_cookie_compliance": "^1.0@beta",
            "drupal/stage_file_proxy": "^1.0@alpha",
            "drupal/shortcutperrole": "^1.0@RC",
            "drupal/roleassign": "^1.0@alpha",
            "drupal/cacheflush": "^1.0@alpha",
            "drupal/webform": "^5.0@beta",
            "drupal/config_ignore": "2.0-rc2",
            "drupal/config_filter": "1.x-dev",
            "drupal/config_split": "^1.0@beta",
            "drupal/captcha": "^1.0@beta",
            "drupal/webform_views": "5.x-dev",
            "drupal/webform_layout_container": "^1.0",
            "drupal/reroute_email": "^1.0@beta",
            "drupal/mailgun": "1.x-dev",
            "drupal/composer_manager": "^1.0@RC",
            "drupal/hook_post_action": "1.x-dev"
        },
        "require-dev": {
            "behat/mink": "~1.7",
            "behat/mink-goutte-driver": "~1.2",
            "jcalderonzumba/gastonjs": "~1.0.2",
            "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
            "mikey179/vfsStream": "~1.2",
            "phpunit/phpunit": "~4.8",
            "symfony/css-selector": "~2.8"
        },
        "conflict": {
            "drupal/drupal": "*"
        },
        "minimum-stability": "dev",
        "prefer-stable": true,
        "autoload": {
            "classmap": [
                "scripts/composer/ScriptHandler.php"
            ]
        },
        "scripts": {
            "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
            "pre-install-cmd": [
                "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
            ],
            "pre-update-cmd": [
                "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
            ],
            "post-install-cmd": [
                "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
            ],
            "post-update-cmd": [
                "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
            ]
        },
        "extra": {
            "installer-paths": {
                "web/core": ["type:drupal-core"],
                "web/libraries/{$name}": ["type:drupal-library"],
                "web/modules/contrib/{$name}": ["type:drupal-module"],
                "web/profiles/contrib/{$name}": ["type:drupal-profile"],
                "web/themes/contrib/{$name}": ["type:drupal-theme"],
                "drush/contrib/{$name}": ["type:drupal-drush"]
            },
            "patches": {
                "drupal/paragraphs": {
                    "IEF Simple Widget not working in paragraphs with preview mode": "https://www.drupal.org/files/issues/ief_simple_widget_not-2722097-36.patch",
                    "Saving problem in preview mode with IEF items": "https://www.drupal.org/files/issues/saving_problem_in-2804377-2.patch"
                },
                "drupal/dropzonejs": {
                    "DropzneJS is cleared on every Ajax response": "https://www.drupal.org/files/issues/dropznejs_is_cleared_on-2827120-11_0.patch",
                    "Improved MultiStep selection display (DropZone Widget)": "https://www.drupal.org/files/issues/improved_multistep-2823670-14.patch"
                },
                "drupal/linkit": {
                    "Missing ckeditor plugin schema": "https://www.drupal.org/files/issues/missing_ckeditor_plugin-2812889-2.patch"
                },
                "drupal/media_entity": {
                    "Make the label form element non-required in the entity form": "https://www.drupal.org/files/issues/2813685-21.patch"
                },
                "drupal/media_entity_instagram": {
                    "Make posts responsive": "https://www.drupal.org/files/issues/make_posts_responsive-2807735-13.patch"
                },
                "drupal/filefield_paths": {
                    "Call to undefined method BaseFieldDefinition::getThirdPartySettings()": "https://www.drupal.org/files/issues/ignore_base_fields.patch"
                },
                "drupal/mailgun": {
                    "Mailgun api version user configurable": "https://www.drupal.org/files/issues/configurable_api_version-2865386.patch"
                },
                "drupal/core" : {
                    "Link Field Causes Pages to 404 with Bad Route Caching on Multilingual Sites": "https://www.drupal.org/files/issues/core_path-alias_manager-language_fallback_and_test-2802403-45-D8.patch"
                },
                "drupal/crop": {
                    "Crop-modulen installDefaultConfig pois": "https://bitbucket.org/!api/2.0/xxxxx/xxxx.patch"
                }
            }
        }
    }
    
    

    I think I was updating Paragraphs to 1.1, Entity Browser to 1.0, Dropzonejs to 1.0-alpha6 and Linkit to 4.3 if that has anything to do with anything.

    Thanks for any assistance, our updates are stuck because of this, so any help is appreciated.

    / Janne

    opened by jiisuominen 17
  • Fail when patches cannot be applied

    Fail when patches cannot be applied

    When a patch cannot be applied, the build simply continues with a warning being output. On automated systems, this is hard to catch. This is a critical issue, as these patches can be used to fix security problems, for instance. Instead, in case of failures, the process should exit with a non-zero error code.

    opened by bartfeenstra 16
  • Patches fail to apply with older versions of Git

    Patches fail to apply with older versions of Git

    With Composer Patches 1.6.3, patches will silently fail to apply on machines with older versions of Git installed. I think it will fail for versions prior to Git 2.9.0, based on this commit: https://github.com/git/git/commit/3f5794493c7a0ba2bba0278b9129d98df343d341

    Empirically, I've tested and verified that Git versions 2.11.0 and above work fine, while 2.7.4 and before fail. I haven't had time to build the versions in between from source in order to test.

    I haven't yet determined whether this is a regression introduced by https://github.com/cweagans/composer-patches/pull/165

    I don't see why that would have caused a regression. But in testing, Composer Patches 1.6.2 works fine while Composer Patches 1.6.3 fails in at least one environment: https://github.com/acquia/lightning/pull/524

    I think the problem is that older versions of git apply silently fail to apply patches, so there's no way for Composer Patches to verify whether they've applied correctly or not. But again, I'm not sure how to reconcile that with the changes in https://github.com/acquia/lightning/pull/524, which should have only been more aggressive in catching git apply failures.

    opened by danepowell 15
  • Please tag a stable release for Composer 2 support

    Please tag a stable release for Composer 2 support

    dev-master works fine with Composer 2 (c.f. #313, #309). It would be nice to have a tagged release so that sites using Composer 2 did not need to use the dev version.

    opened by greg-1-anderson 14
  • Install patches from local file

    Install patches from local file

    I created a .patch file for a Drupal module that I have been using, and I would like to have it versioned with my codebase, but not publicly online. That being said, I would like to have the file stored locally and use a similar syntax to what is already possible, but referring a local file instead of an URL. Is this possible?

    opened by joum 14
  • Make compatible with Composer 2

    Make compatible with Composer 2

    Drupal aims to be compatible with Composer 2. See Issue #3126566.

    As one of the most widely used plugins in Drupal, we should aim to make this plugin compatible with Composer 2 too.

    opened by balsama 12
  • Still array to string exception on multiple patches

    Still array to string exception on multiple patches

    This is strange:

    • With current composer-patches 1.6.4 (i verified manually that the code from #38 is in!)
    • Install drutopia-template current=166076cab and trigger patches (e.g. on update)

    Throws exception below.

    Grepping shows we have the same patch here and there (and no other config_actions patch).

    Exception:

    merlin@thinker ~/PhpstormProjects/igewo (live) $ composer update --lock -v
    Loading composer repositories with package information
    Updating dependencies (including require-dev)              
    Dependency resolution completed in 0.988 seconds
    Analyzed 12106 packages to resolve dependencies
    Analyzed 717852 rules to resolve dependencies
    No patches supplied.
    Gathering patches for dependencies. This might take a minute.
    Found 1 patches for drupal/config_actions.
    Found 1 patches for drupal/entity_reference_revisions.
    Found 1 patches for drupal/search_api.
    Found 2 patches for drupal/features.
      - Installing drupal/config_actions (1.0.0-beta3)
        Loading from cache
        Extracting archive
    
      - Applying patches for drupal/config_actions
    
                                  
      [ErrorException]            
      Array to string conversion  
                                  
    
    Exception trace:
     () at /home/merlin/PhpstormProjects/igewo/vendor/cweagans/composer-patches/src/Patches.php:300
     Composer\Util\ErrorHandler::handle() at /home/merlin/PhpstormProjects/igewo/vendor/cweagans/composer-patches/src/Patches.php:300
     cweagans\Composer\Patches->postInstall() at n/a:n/a
     call_user_func() at phar:///home/merlin/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:170
     Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///home/merlin/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:115
     Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent() at phar:///home/merlin/bin/composer/src/Composer/Installer.php:563
     Composer\Installer->doInstall() at phar:///home/merlin/bin/composer/src/Composer/Installer.php:216
     Composer\Installer->run() at phar:///home/merlin/bin/composer/src/Composer/Command/UpdateCommand.php:174
     Composer\Command\UpdateCommand->execute() at phar:///home/merlin/bin/composer/vendor/symfony/console/Command/Command.php:259
     Symfony\Component\Console\Command\Command->run() at phar:///home/merlin/bin/composer/vendor/symfony/console/Application.php:847
     Symfony\Component\Console\Application->doRunCommand() at phar:///home/merlin/bin/composer/vendor/symfony/console/Application.php:192
     Symfony\Component\Console\Application->doRun() at phar:///home/merlin/bin/composer/src/Composer/Console/Application.php:231
     Composer\Console\Application->doRun() at phar:///home/merlin/bin/composer/vendor/symfony/console/Application.php:123
     Symfony\Component\Console\Application->run() at phar:///home/merlin/bin/composer/src/Composer/Console/Application.php:104
     Composer\Console\Application->run() at phar:///home/merlin/bin/composer/bin/composer:43
     require() at /home/merlin/bin/composer:24
    
    
    opened by geek-merlin 12
  • Throw a new exception after catching Cannot apply patch , so that Com…

    Throw a new exception after catching Cannot apply patch , so that Com…

    Problem

    When a patch fails, an exception is thrown from: https://github.com/cweagans/composer-patches/blob/master/src/Patches.php#L349

    The exception is then catched in https://github.com/cweagans/composer-patches/blob/master/src/Patches.php#L264

    During the Composer install, the patch fails to be applied and the user is informed about the error, but the install process continues.

    Expected Result

    If a patch fails to be applied, an exception should be thrown so that Composer fails the install and the user is notified about the error. Today, if the Composer installs several packages, the user might not wait for the entire install to finish and might therefor miss that a patch failed.

    opened by pivulic 12
  • README.md vs GitHub Actions

    README.md vs GitHub Actions

    README.md line 13

    Beginning in 2.x, the automated tests will not allow us to use language features that will cause syntax errors in PHP 5.6 and later. The unit/acceptance tests do not run on anything earlier than PHP 7.1, so while pull requests will be accepted for those versions, support is on a best-effort basis.

    GitHub Actions line 14

    jobs:
      test:
        runs-on: "ubuntu-22.04"
        strategy:
          matrix:
            php: ["8.0", "8.1", "8.2"]
    

    I think the README.md is not up to date.

    opened by Sweetchuck 0
  • Codeception configuration

    Codeception configuration

    Problems

    1. Use *.dist.yml file name pattern for Codeception configuration files
    2. Namespaces used tests/**/*.php files are not aligned with the namespaces defined in composer.json#/autoload-dev
    3. Directory tests/_support/_generated/ should be added to .gitignore.
    4. Unnecessary file: phpunit.xml.dist
    5. Directory tests/acceptance/fixtures should be somewhere under the tests/_data directory.
    opened by Sweetchuck 0
  • Same patch file gathered multiple times

    Same patch file gathered multiple times

    When there are two or more dependency which provide the same patch file, but with different description, then then second time the patch file cannot be applied.

    Dependency 1

    {
      "patches": {
        "a/a": {
          "Desc 01": "https://example.com/a.patch"
        }
      }
    }
    

    Dependency 2

    {
      "patches": {
        "a/a": {
          "Desc 02": "https://example.com/a.patch"
        }
      }
    }
    

    Then the \cweagans\Composer\Patches::gatherPatches gives the following result:

    {
      "a/a": {
        "Desc 01": "https://example.com/a.patch",
        "Desc 02": "https://example.com/a.patch"
      }
    }
    

    \cweagans\Composer\Util::arrayMergeRecursiveDistinct

    opened by Sweetchuck 1
  • Bump phpro/grumphp from 1.14.0 to 1.15.0

    Bump phpro/grumphp from 1.14.0 to 1.15.0

    Bumps phpro/grumphp from 1.14.0 to 1.15.0.

    Release notes

    Sourced from phpro/grumphp's releases.

    Version 1.15.0

    What's Changed

    New Contributors

    Full Changelog: https://github.com/phpro/grumphp/compare/v1.14.0...v1.15.0

    Commits
    • 533e454 1.15.0 release
    • 941693c Merge pull request #1060 from stof/patch-1
    • 75b1734 Add support for doctrine/collections v2
    • f41ca33 Merge pull request #1059 from MeCapron/feature/add_phpcs_show_sniffs_error_path
    • 69a774e Adding PHPCS specific rule (-s) to display which rule triggered the error
    • 90c429d Update rector suggestion
    • d855145 Merge pull request #1057 from IonBazan/patch-1
    • 762f741 Fix invalid Rector install command
    • 2b327ae Merge pull request #1054 from alessandroaussems/rector
    • f468f1c Remove --no-cache when fixing
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Bump composer/composer from 2.5.0 to 2.5.1

    Bump composer/composer from 2.5.0 to 2.5.1

    Bumps composer/composer from 2.5.0 to 2.5.1.

    Release notes

    Sourced from composer/composer's releases.

    2.5.1

    • Fixed ClassLoader regression which made it fail if serialized (e.g. within PHPUnit process isolation) (#11237)
    • Fixed preg type error in svn version guessing (#11231)
    Changelog

    Sourced from composer/composer's changelog.

    [2.5.1] 2022-12-22

    • Fixed ClassLoader regression which made it fail if serialized (e.g. within PHPUnit process isolation) (#11237)
    • Fixed preg type error in svn version guessing (#11231)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
Releases(1.7.3)
  • 1.7.3(Dec 21, 2022)

    What's Changed

    • Add installedPatches property to fix PHP 8.2 deprecation 1.x version by @seamuslee001 in https://github.com/cweagans/composer-patches/pull/422

    New Contributors

    • @seamuslee001 made their first contribution in https://github.com/cweagans/composer-patches/pull/422

    Full Changelog: https://github.com/cweagans/composer-patches/compare/1.7.2...1.7.3

    Source code(tar.gz)
    Source code(zip)
  • 1.7.1(Jun 9, 2021)

    This release resolves a compatibility problem with 2.1 where packages would be deleted and not reinstalled during patching. Thanks to @Seldaek for the resolution on both the 1.x and master branches!

    Changes since 1.7.0:

    • https://github.com/cweagans/composer-patches/pull/364
    Source code(tar.gz)
    Source code(zip)
  • 1.7.0(Oct 6, 2020)

  • 1.6.7(Aug 29, 2019)

  • 1.6.6(May 22, 2019)

    • Readme fixups
    • PHP 5.3 compatibility fix
    • Resolves some array to string conversion errors
    • Check that a package actually has patches before uninstalling/reinstalling
    Source code(tar.gz)
    Source code(zip)
  • 1.6.5(Jun 14, 2018)

  • 1.6.4(Dec 7, 2017)

  • 1.6.3(Nov 29, 2017)

    Two critical bugfixes are included in this release:

    • Exiting on patch failure was not working (https://github.com/cweagans/composer-patches/pull/166)
    • Newer versions of Git were breaking patch application (https://github.com/cweagans/composer-patches/pull/171)
    Source code(tar.gz)
    Source code(zip)
  • 1.6.0(Dec 1, 2016)

  • 1.5.0(May 31, 2016)

Owner
Cameron Eagans
Cameron Eagans
Plugin for composer to apply patches onto dependencies.

composer-patches-plugin This plugin allows you to provide patches for any package from any package. If you don't want a patch package outside the root

Netresearch 75 Aug 7, 2022
A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the vendor folder.

composer-custom-directory-installer A composer plugin, to install differenty types of composer packages in custom directories outside the default comp

Mina Nabil Sami 136 Dec 30, 2022
Ied plugin composer - Inspired Plugin Composer: Create, publish and edit plugins from within Textpattern CMS.

ied_plugin_composer Create, publish and edit plugins from within Textpattern CMS. Creates a new page under the Extensions tab where you can edit and e

Stef Dawson 8 Oct 3, 2020
Opinionated version of Wikimedia composer-merge-plugin to work in pair with Bamarni composer-bin-plugin.

Composer Inheritance Plugin Opinionated version of Wikimedia composer-merge-plugin to work in pair with bamarni/composer-bin-plugin. Usage If you are

Théo FIDRY 25 Dec 2, 2022
Patches that prevent malicious Minecraft plugins from saturating host internet resources for DDoS.

Minecraft Host DoS Botnet Patches Patches that prevent malicious Minecraft plugins from saturating host internet resources for DDoS. In recent events,

Riley Nevins 4 Jul 16, 2022
As many Magento patches as I can find!

Magento Resources and Links I have been looking for a good repository for all resources for Magento and I thought I will start putting them here for n

Brent W. Peterson 271 Dec 22, 2022
Audit your PHP version for known CVEs and patches

PHP Version Audit PHP Version Audit is a convenience tool to easily check a given PHP version against a regularly updated list of CVE exploits, new re

Daniel 103 Dec 19, 2022
Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins.

Imposter Plugin Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins. Built with ♥ by Typ

Typist Tech 127 Dec 17, 2022
Composer Registrar Composer Plugin for Magento 2

This module add a global registration.php that replace the default glob search performed for each request to discover the components not installed from composer.

OpenGento 3 Mar 22, 2022
Magento-composer-installer - Composer installer for Magento modules

!!! support the maintainer of this project via Patreon: https://www.patreon.com/Flyingmana Magento Composer Installer The purpose of this project is t

null 213 Sep 24, 2022
Composer Repository Manager for selling Magento 2 extension and offering composer installation for ordered packages.

Magento 2 Composer Repository Credits We got inspired by https://github.com/Genmato. Composer Repository for Magento 2 This extension works as a Magen

EAdesign 18 Dec 16, 2021
Composer registry manager that help to easily switch to the composer repository you want

CRM - Composer Registry Manager Composer Registry Manager can help you easily and quickly switch between different composer repositories. 简体中文 Install

Tao 500 Dec 29, 2022
Dependency graph visualization for composer.json (PHP + Composer)

clue/graph-composer Graph visualization for your project's composer.json and its dependencies: Table of contents Usage graph-composer show graph-compo

Christian Lück 797 Jan 5, 2023
Drupal Composer Scaffold - A flexible Composer project scaffold builder

This project provides a composer plugin for placing scaffold files (like index.php, update.php, …) from the drupal/core project into their desired location inside the web root. Only individual files may be scaffolded with this plugin.

Drupal 44 Sep 22, 2022
Victor The Cleaner for Composer - This tool removes unnecessary files and directories from Composer vendor directory.

Victor The Cleaner for Composer This tool removes unnecessary files and directories from Composer vendor directory. The Cleaner leaves only directorie

David Grudl 133 Oct 26, 2022
Composer plugin for Repman - PHP Repository Manager

Repman Composer Plugin Composer plugin for Repman - PHP Repository Manager. Adds a mirror url for all your dependencies without need to update compose

Repman 9 Mar 14, 2022
Composer plugin replacing placeholders in the scripts section by dynamic values

Composer Substitution Plugin The Composer Substitution plugin replaces placeholders in the scripts section by dynamic values. It also permits to cache

Fabien Villepinte 49 Jan 8, 2022
Textpattern-installer - Textpattern plugin and theme installer for Composer

Textpattern Installer for Composer Package directory | Issues Install plugins and themes to Textpattern CMS with Composer. $ composer require rah/rah_

Jukka Svahn 7 Apr 14, 2022
Composer Plugin for automatically including files for easing function usage in php.

Php Inc Php inc is a composer plugin for automatically including certain files into composer's autoload and autoload-dev files config. Given a set of

Krak 5 Jan 11, 2022