symfonycomposer-phpphp-deployer

Ignore packagist.org and specify path for one bundle


I modified a symfony 4 bundle to fix some bug. I now want to deploy my project through https://deployer.org/.

So I added this bundle not ignored in the .gitignore so that the folder of the bundle with my modifications is available on my github repo.

When executing the "deploy" command of deployer, it executes the command "/composer.phar install --verbose --prefer -dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest" so that the folder of my bundle edit is overwritten by the original bundle folder from https://packagist.org/.

I would like to modify my composer.json to define the path of my modified bundle and that it is not overwritten.

Here is what I tried in the composer.json of my main project:

{
    "type": "my-project",
    "license": "proprietary",
    "repositories": [
        {
            "type": "path",
            "url": "/vendor/my/modifiedBundle",
            "packagist.org": false,
        }
    ],
    "require": {
        ......
        "my/modifiedBundle": "0.6.1",
        ......
    },
    "require-dev": {
        .....
    },
    "config": {
        "preferred-install": {
            "my/modifiedBundle": "source",
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        ....
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": true,
            "require": "4.3.*"
        }
    }
}

Here is the composer.json of my modified bundle:

{
  "name": "my/modifiedBundle",
  "type": "symfony-bundle",
  "license": "MIT",
  "require": {
    ...
  },
  "require-dev": {
    ...
  },
  "config": {
    "sort-packages": true
  },
  "autoload": {
    "psr-4": {
      "my\\modifiedBundle\\": ""
    }
  },
  "autoload-dev": {
    "psr-4": {
      "my\\modifiedBundle\\Tests\\": "tests/"
    }
  }
}

But after my modifications, the modified bundle is still overwritten by the original bundle, do you have any idea?


Solution

  • @Skros2 solved his problem on:

    how to refer a fork.

    {
        "repositories": [
            {
                "type": "git",
                "url": "https://github.com/foobar/intermediate.git"
            },
            {
                "type": "pear",
                "url": "http://pear.foobar.repo",
                "vendor-alias": "foobar"
            }
        ],
        "require": {
            "foobar/TopLevelPackage1": "*",
            "foobar/TopLevelPackage2": "*"
        }
    }