I've created a new module with a composer.json file:

  "extra": {
      "composer-exit-on-patch-failure": true,
      "patches": {
          "magento/framework": {
              "TransportBuilder doesn't add 'to' email-addresses, if given in an array": "https://github.com/magento/magento2/commit/be5455a58240b57e4dc0c44a5cea2bb5a2e01c57.diff"

And what I want to achieve is to apply that change from that commit to this file: vendor/magento/framework/Mail/Template, when i install my module .

By doing a composer require mymodule, my module is installed, but the patch is not applied. I also use this package: cweagans/composer-patches as the docs suggested. What do i miss ?

[UPDATE] - Same If i change the url from ....diff into


I am getting:

    https://github.com/magento/magento2/commit/be5455a58240b57e4dc0c44a5cea2bb5a2e01c57.patch (TransportBuilder doesn't add 'to' email-addresses, if given in an array)
patch '-p1' --no-backup-if-mismatch -d '/Users/attilanaghi/Development/local/vendor/magento/framework' < '/var/folders/rd/rg6xy_fs00bgwvmbpw2myyrr0000gn/T/5e1716d50d06b.patch'
can't find file to patch at input line 15
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

[UPDATE] . I am trying to use the extra/map. See: https://github.com/magento/magento-composer-installer . But so far without any luck. Any ideas how can i apply my patch ?

  "type": "magento2-module",
  "extra": {
    "magento-force": true,
    "map": [
            "patches/github_issue_25453.patch", "patches/github_issue_25453.patch"

1 Answer 1


Need to add like that in composer.json file

"scripts": {
        "post-install-cmd": [
             "patch -p1 < custompatch.patch" 

Then run command

composer update
  • i see you added the .patch extension. That means i need to create that file, cannot i just use a github commit ? like it is in my description ? Jan 9, 2020 at 11:50
  • can you check my post update ? Jan 10, 2020 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.