简体   繁体   中英

Composer fails to load fork from package

I struggle loading a fork for a package with composer. I am trying to integrate Swaggervel, a Swagger package for Laravel 5, into my project. The current dev-master has a bug which causes incompatibility to laravel 5.

BUT there is a fork on github https://github.com/mvpasarel/swagger-laravel which fixes this issue.

So this is how I try to point at the fork in my composer.json file.

"repositories": [
{
  "type": "vcs",
  "url": "https://github.com/mvpasarel/swagger-laravel"
}],

"require": {
    "laravel/framework": "5.0.*",
    "phpunit/phpunit": "~4.5",
    "jlapp/swaggervel": "dev-master"
}, ...

I read many posts in different communities to understand how to achieve what I want. This is so far my best shot, but unfortunately in my vendor/project/ folder I still see the "old source" from jlapp/swaggervel and not the updated source from mvpasarel/swagger-laravel.

Just for completion here is a part of my composer.lock

{
        "name": "jlapp/swaggervel",
        "version": "dev-master",
        "source": {
            "type": "git",
            "url": "https://github.com/mvpasarel/swagger-laravel.git",
            "reference": "6e75f294ffa65823247e1f9f9f88402a75aa14f5"
        },
        "dist": {
            "type": "zip",
            "url": "https://api.github.com/repos/mvpasarel/swagger-laravel/zipball/6e75f294ffa65823247e1f9f9f88402a75aa14f5",
            "reference": "6e75f294ffa65823247e1f9f9f88402a75aa14f5",
            "shasum": ""
        },
        "require": {
            "php": ">=5.3.0",
            "zircote/swagger-php": "*"
        },
        "type": "library",
        "autoload": {
            "psr-0": {
                "Jlapp\\Swaggervel": "src/"
            }
        },
        "license": [
            "MIT"
        ],
        "authors": [
            {
                "name": "jlapp",
                "email": "jordan@jordanlapp.com"
            }
        ],
        "description": "A great way to integrate Swagger into Laravel",
        "keywords": [
            "laravel",
            "swagger"
        ],
        "support": {
            "source": "https://github.com/mvpasarel/swagger-laravel/tree/master"
        },
        "time": "2014-11-20 21:43:03"
    },

Any idea what I am doing wrong? Thank you!

Here is how you should load a fork:

composer.json:

{   
  "repositories": [
    {
      "type": "git",
      "url": "git@github.com:mvpasarel/swagger-laravel.git"
    }   
   ],    
   "require": {
    "laravel/framework": "5.0.*",
    "jlapp/swaggervel": "dev-laravel5"   
   }
}

You will have to add the repository "url": "git@github.com:mvpasarel/swagger-laravel.git" of the fork and keep the name of the original package but add the "dev-" + name of the branch on the fork you want to load, in this case: "jlapp/swaggervel": "dev-laravel5"

This is how I use it, let me know if it works for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM