Contributing to open source bundles from vendor directory?

前端 未结 4 1427
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-04 22:06

Ideal Situation

Often while working on a Symfony2 project I will spot something I want to change in one of my dependencies. If I could find a way to

相关标签:
4条回答
  • 2020-12-04 22:47

    FYI, I just tried the very first option:

        "repositories": [{
        "type": "vcs",
        "url": "https://github.com/thujohn/twitter"
    }],
    "require": {
        "laravel/framework": "4.2.*",
        "thujohn/twitter": "dev-master",
        "anahkiasen/flickering": "^0.1.2",
        "fairholm/elasticquent": "dev-master",
        "facebook/php-sdk-v4" : "~5.0"
    },
    

    An it worked fine.

    vagrant@dev:/var/www$ sudo php composer.phar update
    Loading composer repositories with package information                                                                                                                                                         Updating dependencies (including require-dev)         
      - Removing thujohn/twitter (2.0.4)
      - Installing thujohn/twitter (dev-master 7a92118)
        Downloading: 100%         
    
    Writing lock file
    Generating autoload files
    > php artisan clear-compiled
    > php artisan optimize
    Generating optimized class loader
    

    I just needed to specify the "master" branch name as "dev-master".

    0 讨论(0)
  • 2020-12-04 22:48

    [UPDATE: Answer Not Valid Anymore]

    As pointed out in one of the comments, this answer is a couple years old and not correct anymore. See answers below for the correct way to proceed.

    [Original answer below]

    This is the approach recommended by Jordi Boggiano (@Seldaek), creator of composer. See from his talk at Symfony Live San Francisco earlier this year (at the 2 minutes mark): http://www.youtube.com/watch?list=PLo7mBDsRHu11ChvScWUE7MN1Qo5QVHQEz&feature=player_detailpage&v=P3NwF8RV1lY#t=120s

    0 讨论(0)
  • 2020-12-04 23:07

    Nah... this is broken.

    I've tried the official way to include a fork, here's an example (original:kitano, fork: jstoeffler) of the composer.json :

    (For those who are in a hurry: THIS DOESNT WORK)

    "repositories": [
    //...
        {
            "type": "vcs",
            "url": "https://github.com/jstoeffler/KitanoConnectionBundle",
    
        },
    //...
    ],
    

    It keeps using the original bundle. Don't know what the problem is, and I don't get how everything works, but here's how I successfully add a fork to a project.

    "repositories": [
    //...
        {
            "type": "package",
            "package": {
                "name": "kitano/connection-bundle",
                "version": "dev-master",
                "source": {
                    "url": "https://github.com/jstoeffler/KitanoConnectionBundle.git",
                    "type": "git",
                    "reference": "master"
                },
                "autoload": {
                    "classmap": [""]
                }
            }
        },
    //...
    ],
    
    0 讨论(0)
  • 2020-12-04 23:08

    As of 2017 the proper way to do it is:

    1. Add your GitHub branch link to the repositories

      "repositories": [
          {
              "type": "vcs",
              "url": "https://github.com/crimson-med/yii2-link-preview"
          }
      ],
      
    2. Add the source to the require of your composer.json

      "require": {
          "yii2mod/yii2-link-preview": "dev-master"
      },
      
    0 讨论(0)
提交回复
热议问题